Git info

Mr.Hope ... 2021-3-8 Feature
  • Feature
  • Last update
Less than 1 minute

vuepress-theme-hope will automatic generate the create time, last update time and contributors of the page through the built-in @mr-hope/vuepress-plugin-git (opens new window) plugin.

By default, the plugin will get the UNIX timestamp(ms) of each file’s fist and last git commit for you, and it will also display at the bottom of each page in an appropriate format.

At the same time, all contributors to the page will be displayed at the bottom of the page.

  • If you don’t want to show last update time, please set themeConfig.lastUpdated to false.
  • If you don’t want to show contributors, please set themeConfig.contributors to false.

Note

Since the last update time is based on git, you can only enable it in a project based on git. Since the timestamp used is from git commit, it will only be displayed after the first commit of a given page, and will only be updated when subsequent changes are committed to that page.

Sometimes your site may be automatically deployed through CI, and the time of these CI servers may be based on UTC, which will cause the generated time to be different from your time zone. In this case, you can set themeConfig.git.timezone to specify your timezone.

Timezone list

For detailed timezone list, please see Timezone List (opens new window)

The theme will use dayjs to automatically localize the text of the last update time according to the current language. If you are not satisfied with the default display text, you can set your own time conversion function to themeConfig.git.transformer. The format of the function is (timestamp: number, lang: string) => string

Last update: June 6, 2022 05:33
Contributors: Mr.Hope , Mr.Hope