Page Meta
The theme displays last update time and contributors of the page via the @vuepress/plugin-git plugin, and provides support for an "edit this page" button.
The theme also provides navigation buttons for previous and next pages depending on sidebar config.
Git-based Information
vuepress-theme-hope uses the built-in @vuepress/plugin-git plugin to automatically generate page create time, last update time and contributors.
The plugin will automatically generate the page creation time and last update time from the UNIX timestamp (ms) of git commit history of the page file, and generate contributors based on the commit record.
The theme will display last update time in the appropriate date format, along with all page contributors at the bottom of the page.
Limitations
Since the contributors, last update time, and file creation time information are based on
git, you can only enable it in agitbased project.Since related information are from git commits, they will only be displayed after the first commit for a given page, and will only be updated when some commits change that page.
Since the
gitplugin needs to call Git binary and involves file IO, this function will seriously affect the startup and hot update speed, so by default theme will not be enabled in devServer. Setplugins.git: trueorhotReload: truein theme options if needed.
Edit Link
You can automatically generate edit links for each page by setting the following items in theme options:
docsRepo: docs repository link, same asrepoby defaultdocsDir: the directory of docs in the repository, defaults to root directorydocsBranch: docs branch, defaults to"main"
import { hopeTheme } from "vuepress-theme-hope";
export default hopeTheme({
  docsRepo: "vuepress/docs",
  docsDir: "docs",
  docsBranch: "next",
});Display Control
To hide these items globally, set the corresponding items below to false in theme options. You can also enable/disable specific pages by setting these items in page frontmatter:
lastUpdated: whether to display last update time of the pagecontributors: whether to show page contributors, supportcontent,metaandbooleaneditLink: whether to display "edit page" linkchangelog: whether to show changelog
Example
Disable contributors globally:
import { hopeTheme } from "vuepress-theme-hope";
export default hopeTheme({
  contributors: false,
});Disable changelog in example.md page:
---
changelog: false
---Changelog
9a004-on12a7b-on253d1-on76d91-ond7092-onbdfcb-on2f94f-on0fe94-one8287-on8174c-onc1ce1-onad023-one07b5-onfd395-onbde8d-on60053-on0c093-on4d1ba-onf6ff0-on37324-on04b8a-on3c199-on