PageLastCommit
Overview
The PageLastCommit component displays the last update information for the current documentation page, including:
- Update time: the time of the file's most recent commit
- Author info: the committer's GitHub username (clickable)
- Commit message: the message of the most recent commit (clickable to jump to the specific commit)
This component is built into the header area of documentation pages, with no need to add it manually.
Demonstration
The component displays something like the following below the page description:
Last updated on 2025/11/26 14:37 by
mhaibaraaiwithdocs: refine documentation content and add template notes
Prerequisites
1. GitHub Token configuration
Configure your GitHub Personal Access Token in the .env file:
NUXT_GITHUB_TOKEN=ghp_your_personal_access_token_here
repo or public_repo scope).2. GitHub configuration
Make sure your GitHub information is configured correctly in app/app.config.ts:
export default defineAppConfig({
github: {
rootDir: 'docs', // The directory where the docs live
}
})
Customizing the date format
You can customize the date display format via the dateFormat configuration:
export default defineAppConfig({
github: {
rootDir: 'docs',
dateFormat: {
locale: 'zh-CN',
options: {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
}
}
}
})
Common date format examples
| Configuration | Example output |
|---|---|
{ year: 'numeric', month: 'short', day: 'numeric' } | Nov 26, 2025 |
{ year: 'numeric', month: 'numeric', day: 'numeric' } | 11/26/2025 |
{ year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' } | 11/26/2025 14:37 |
{ dateStyle: 'full' } | Wednesday, November 26, 2025 |
{ dateStyle: 'medium', timeStyle: 'short' } | Nov 26, 2025, 14:37 |
dateFormat.options uses the standard Intl.DateTimeFormatOptions configuration.PR squash merge support
The component intelligently handles GitHub's PR squash-merge scenario:
- When it detects that the committer is
web-flow(GitHub's automatic merge bot) - It automatically parses the PR number from the commit message (such as
#123) - It fetches and displays the actual PR author's information
API
Props
| Prop | Default | Type |
|---|---|---|
stem | '' | string文件路径(不含扩展名),通常由页面自动传入 |
extension | 'md' | string文件扩展名,通常由页面自动传入 |
showMessage | true | boolean是否显示提交信息。 |
showAvatar | true | boolean是否显示作者头像。 |
Related
- CommitChangelog — display the complete Git commit timeline for a component
Changelog
CommitChangelog
CommitChangelog automatically fetches the Git commit history of a specific component or file from a GitHub repository and displays it as timeline cards. It supports filtering by filename, path, and author, as well as path inference via commitPath, suffix, and casing. Requires the NUXT_GITHUB_TOKEN environment variable.
useHeader
useHeader configures the header navigation links, defining the desktop menu items via desktopLinks with active route highlighting support. Create a file of the same name at app/composables/useHeader.ts to override this composable and fully customize the header navigation structure and link content.