---
title: "PageLastCommit"
description: "Show the date, author, and message of the latest commit to a docs page's Markdown file."
canonical_url: "https://docs.mhaibaraai.me/en/docs/components/page-last-commit"
---
# PageLastCommit

> Show the date, author, and message of the latest commit to a docs page's Markdown file.

`PageLastCommit` is already mounted in the meta row below the lead of every docs page, next to the source and copy page links; you never add it in Markdown. It shows:

- **Updated at**: the time of the file's latest commit, formatted with `github.dateFormat`
- **Author**: the committer's GitHub username and avatar, linking to their profile
- **Message**: the first line of the commit message, linking to the commit

## When it appears

Like [CommitChangelog](https://docs.mhaibaraai.me/en/docs/components/commit-changelog), it needs a working GitHub integration and `NUXT_GITHUB_TOKEN`:

```bash [.env]
NUXT_GITHUB_TOKEN=<your-github-token>
```

The file path is `{github.rootDir}/content/{page path}`. Set `rootDir` when the docs site is not at the repository root:

```ts [app/app.config.ts]
export default defineAppConfig({
  github: {
    rootDir: 'docs'
  }
})
```

> [!WARNING]
> 
> With a wrong 
> 
> rootDir
> 
>  no commit is found and the component renders nothing. Set 
> 
> github: false
> 
>  to turn off the GitHub integration entirely.

## Date format

`github.dateFormat.locale` and `github.dateFormat.options` are passed to [`Intl.DateTimeFormat`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#options). The layer defaults to `zh-CN` with year, month, day, hour and minute, in the server's time zone:

```ts [app/app.config.ts]
export default defineAppConfig({
  github: {
    dateFormat: {
      locale: 'en-US',
      options: {
        dateStyle: 'medium',
        timeStyle: 'short',
        timeZone: 'Asia/Shanghai'
      }
    }
  }
})
```

> [!TIP]
> 
> Dates are formatted on the server. Prerendered sites show the build machine's time zone; set 
> 
> timeZone
> 
>  explicitly to pin it.

| `options` | Output (`en-US`) |
| --- | --- |
| `{ year: 'numeric', month: 'numeric', day: 'numeric' }` | 10/23/2026 |
| `{ year: 'numeric', month: 'short', day: 'numeric' }` | Oct 23, 2026 |
| `{ dateStyle: 'medium', timeStyle: 'short' }` | Oct 23, 2026, 2:37 PM |

## PR squash merge

When a PR is merged on github.com, the committer is `web-flow`. The component detects this, parses the PR number from the message (such as `#123`), shows the PR author instead and links to the PR.

## Customization

Props are passed in by the docs page, so `showAvatar` and `showMessage` cannot be set from Markdown. To hide the avatar or message, or restyle it, override the component with one of the same name in your project; `PageLastCommit` is not part of the [override contract](https://docs.mhaibaraai.me/en/docs/guide/customization), so check it against the new implementation when upgrading.

## API

### Props

```ts
/**
 * Props for the PageLastCommit component
 */
interface PageLastCommitProps {
  /**
   * 文件路径（不含扩展名），通常由页面自动传入
   * @default ''
   */
  stem: string;
  /**
   * 文件扩展名，通常由页面自动传入
   * @default 'md'
   */
  extension: string;
  /**
   * 是否显示提交信息。
   * @default true
   */
  showMessage?: boolean | undefined;
  /**
   * 是否显示作者头像。
   * @default true
   */
  showAvatar?: boolean | undefined;
}
```

## Related

- [CommitChangelog](https://docs.mhaibaraai.me/en/docs/components/commit-changelog): the full commit timeline of a component or source file

## Changelog

See commit history for [layer/app/components/content/PageLastCommit.vue](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/app/components/content/PageLastCommit.vue).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/app/components/content/PageLastCommit.vue)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.me/sitemap.md) for all pages.
