快轉到主要內容

Archive

查看原始碼編輯此頁 (外部連結)
首次發表:

main.html (外部連結)

Yore provides a dedicated archive feature to aggregate all posts into a single list.

Setup 此標題的連結

Create _index.md in your archive section and set listScope: site in its front matter. The file must be named _index.md. Using index.md prevents Hugo from treating it as a list page.

Sorting and grouping are not automatically chronological. Set sectionSortBy, sectionGroupBy, and related params explicitly to get the expected behavior.

content/archive/_index.md
---
title: Archive
params:
  listScope: site
  sectionSortBy: Date
  sectionSortOrder: desc
  sectionGroupBy: Date
  sectionGroupLayout: "January 2006"
  sectionGroupOrder: desc
---

Sorting and grouping options 此標題的連結

The options of sectionSortBy, sectionGroupBy and related params uses Hugo's method (外部連結).

ParamTypeDescription
sectionSortBystringField used to sort pages. Accepts any Pages method (外部連結): Date, ExpiryDate, Lastmod, Length, LinkTitle, PublishDate, Title, Weight, or Param.[FRONT_MATTER_KEY].
sectionSortOrder'asc' | 'desc'Sort direction.
sectionGroupBystringField used to group pages. Accepts Date, ExpiryDate, Lastmod, PublishDate, or Param.[FRONT_MATTER_KEY].
sectionGroupLayoutstringGo time format string for group headings. Example: "January 2006" or "2006年1月". See layout strings (外部連結).
sectionGroupOrder'asc' | 'desc'Group sort direction.

Excluding pages 此標題的連結

pageNoList: true excludes a page from list pages (including the archive) and search results.

It does not remove the page from the sitemap. To exclude the page from the sitemap as well, customize Hugo's built-in sitemap template (外部連結). See the official documentation (外部連結).

文章關聯

無障礙設定