HomeLogo

@mr-hope/vuepress-plugin-last-update

Last update plugin for vuepress

This plugin will use git to inject a readable last update time and a last update time timestamp into the page.

Why use this plugin

The internationalization support of the official plugin is not good, this plugin provides better multi-language support.

# How to use

# Install

npm i -D @mr-hope/vuepress-plugin-last-update
1

Or

yarn add -D @mr-hope/vuepress-plugin-last-update
1

# Usage

// .vuepress/config.js
module.exports = {
  plugins: [["@vuepress/last-updated", false], "@mr-hope/last-update"],
};
1
2
3
4

Note

You must disable the official plugin!

# Plugin description

To let the plugin work, your docs should be a git project, the plugin will automatically read the file’s last commit time and inject it into lastUpdated in a localized form. At the same time, it will inject a timestamp in lastUpdatedTime for use by other plugins.

# Configuration

# transformer

  • Type: (timestamp: number, lang: string) => string
  • Default value: `${dayjs(timestamp).format('LL')} ${dayjs(timestamp).format('HH:mm')}`

Time conversion function, by default, will use dayjs to automatically localize according to the current page language.

Such as: 2020年5月8日 16:05 May 8, 2020 16:05