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.
Tips
The theme will use Date.toLocaleString(pageLang)
to automatically localize the text of last update time according to the current language.
Limitations
Since the contributors, last update time, and file creation time information are based on
git
, you can only enable it in agit
based 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
git
plugin 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: true
orhotReload: true
in 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 asrepo
by defaultdocsDir
: the directory of docs in the repository, defaults to root directorydocsBranch
: docs branch, defaults to"main"
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 contributorseditLink
: whether to display "edit page" link