# Fumadocs MDX (the built-in content source): 最後修改時間
URL: /zh-TW/docs/mdx/last-modified
Source: https://raw.githubusercontent.com/fuma-nama/fumadocs/refs/heads/main/apps/docs/content/docs/mdx/last-modified.zh-TW.mdx

輸出文件的最後修改時間

## 使用方式 [#usage]

您可以在設定檔中加入此外掛。

<Callout type="warning" title="預設使用 Git">
請確認您的電腦已安裝 Git，且**儲存庫並非透過淺層複製 (shallow
clone) 取得**，因為此功能需要讀取您本機的 Git 歷史紀錄。
</Callout>

```ts title="source.config.ts"
import { defineConfig } from 'fumadocs-mdx/config';
import lastModified from 'fumadocs-mdx/plugins/last-modified';

export default defineConfig({
  // [!code ++]
  plugins: [lastModified()],
});
```

### 存取屬性 [#access-the-property]

完成後，每份文件都會匯出 `lastModified` 屬性 (型別為 `Date`) 。

```ts
import { source } from '@/lib/source';

const page = source.getPage(['...']);

console.log(page.data.lastModified);
// 或使用延遲載入
const { lastModified } = await page.data.load();
console.log(lastModified);
```

您可以透過 [`<DocsPage />`](/docs/ui/layouts/page#last-updated-time) 等 UI 元件來顯示此資訊