Skip to content

功能页配置

Teek 支持构建分类页、标签页、归档页,文章清单页、登录页、风险链接提示页,这些页面本质上是一个 Markdown 文档,通过在 frontmatter配置来开启功能,因此可以与其他文档一起放到任意目录下,并且和正常 Markdown 文档一样可以进行内容编写。

但是 Teek 建议放在 @pages目录下,因为 Teek 不会对 @pages目录下的文档做任何处理(自动生成侧边栏、站点分析,自动生成 frontmatter等)。

sh
.├─@pages├──archivesPage.md├──articleOverviewPage.md├──categoriesPage.md├──loginPage.md├──riskLinkPage.md├──tagsPage.md

分类页

frontmatter中配置 categoriesPage:truelayout:home来开启分类页。

yaml
---title:分类permalink:/categoriescategoriesPage:truelayout:homearticle:false---

permalink需要配置为 /categories,如果你希望修改为 /c,需要在主题配置中配置 category.path/c

ts
import{defineTeekConfig } from"vitepress-theme-teek/config";constteekConfig=defineTeekConfig({category:{path:"/c",},});

标签页

frontmatter中配置 tagsPage:truelayout:home来开启标签页。

yaml
---title:标签permalink:/tagstagsPage:truelayout:homearticle:false---

permalink需要配置为 /tags,如果你希望修改为 /t,需要在主题配置中配置 tag.path/t

ts
import{defineTeekConfig } from"vitepress-theme-teek/config";constteekConfig=defineTeekConfig({tag:{path:"/t",},});

归档页

有两种方式可以开启归档页:

  1. frontmatter配置 archivesPage:truelayout:page来开启归档页
  2. frontmatter配置 layout:TkCataloguePage来开启归档页
yaml
---title:归档permalink:/archivesarchivesPage:truelayout:pagearticle:falsesidebar:false---
yaml
---title:归档permalink:/archiveslayout:TkCataloguePagearticle:falsesidebar:false---

permalink没有强制要求为 /archives,你可以根据自己的需求进行配置,然后在导航栏配置 urlpermalink的值即可。

通过 frontmatter,你可以定制归档页的部分文字:归档页所有可以配置的 frontmatter如下:

yaml
---title:归档permalink:/archiveslayout:TkCataloguePagetotalCount:总共 {count} 篇文章year:month:count:notFound:未指定---

这些文字优先级会覆盖 Teek 的国际化文字。

文章清单页 v1.2.0

有两种方式可以开启文章清单页:

  1. frontmatter配置 articleOverviewPage:truelayout:page来开启文章清单页
  2. frontmatter配置 layout:TkArticleOverviewPage来开启文章清单页
yaml
---title:归档permalink:/articleOverviewarticleOverviewPage:truelayout:pagearticle:falsesidebar:false---
yaml
---title:归档permalink:/articleOverviewlayout:TkArticleOverviewPagearticle:falsesidebar:false---

permalink没有强制要求为 /articleOverview,你可以根据自己的需求进行配置,然后在导航栏配置 urlpermalink的值即可。

您可以通过 publishDateFormat来设置发布时间的格式,比如 yyyy-MM-dd,默认为 yyyy-MM-dd hh:mm:ss

yaml
---title:文章清单permalink:/articleOverviewarticleOverviewPage:truelayout:pagepublishDateFormat:yyyy-MM-ddarticle:falsesidebar:false---

登录页 v1.3.0

有两种方式可以开启登录页:

  1. frontmatter配置 loginPage:truelayout:false来开启登录页,此时登录页不含有导航
  2. frontmatter配置 layout:TkLoginPage来开启登录页,此时登录页顶部有导航
yaml
---permalink:/loginlayout:falseloginPage:truelogo:/teek-logo-large.pngname:VitePress Theme TeekleftImg:/login/bg-1.pngarticle:false---
yaml
---permalink:/loginlayout:TkLoginPagelogo:/teek-logo-large.pngname:VitePress Theme TeekleftImg:/login/bg-1.pngarticle:false---

leftImg:/login/bg-1.pngv1.3.4是添加左侧图片的配置项,如果添加该配置,左侧将会出现图片,右侧为登录框;如果不添加该配置,则登录框位于屏幕中间。

风险链接提示页 v1.3.0

有两种方式可以开启风险链接提示页:

  1. frontmatter配置 riskLinkPage:truelayout:false来开启登录页,此时风险链接提示页不含有导航
  2. frontmatter配置 layout:TkRiskLinkPage来开启登录页,此时风险链接提示页顶部有导航
yaml
---permalink:/risk-linklayout:falseriskLinkPage:truelogo:/teek-logo-large.pngname:VitePress Theme Teek# 与 desc 二选一desc:即将离开 VitePress Theme Teek,请注意财产安全# 与 name 二选一linkIllegal:链接安全性校验中,请稍后 ...article:false---
yaml
---permalink:/risk-linklayout:TkRiskLinkPagelogo:/teek-logo-large.pngname:VitePress Theme Teek# 与 desc 二选一desc:即将离开 VitePress Theme Teek,请注意财产安全# 与 name 二选一linkIllegal:链接安全性校验中,请稍后 ...article:false---
最近更新