feat: archives page (#922)

* feat: archives page

* fix: empty archive show 'no posts found' message
* Add ToC partials for structural consistency
* Fix empty archive showing blank page

* fix: rename archive to archives

* chore: enhance archives and additional pages support

- Updated the menu structure in hugo.yaml to include new sections for 'About', 'Archives', and 'Glossary' under 'More'.
- Added new archive index files for multiple languages (Farsi, Japanese, Simplified Chinese) to support multilingual content.
- Created additional pages documentation for glossary and archives in multiple languages.
- Updated references in existing documentation to point to the new additional pages structure.
- Improved the archives layout to display a user-friendly message when no posts are found.

* fix: update date format in archives layout

- Changed the date format in the archives layout from a partial to a direct format for improved readability, displaying dates as "Jan 02".

* feat: add archive date format customization

- Introduced a new parameter in hugo.yaml for customizing the date format of archive items, defaulting to "Jan 02".
- Updated documentation in multiple languages to reflect the new optional date format feature for archives.

---------

Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
Tyler
2026-02-08 19:45:29 +08:00
committed by GitHub
parent 2d5adf0e40
commit 04803c4071
27 changed files with 328 additions and 44 deletions

View File

@@ -0,0 +1,5 @@
---
title: آرشیو
layout: archives
toc: false
---

View File

@@ -0,0 +1,5 @@
---
title: アーカイブ
layout: archives
toc: false
---

View File

@@ -0,0 +1,5 @@
---
title: Archives
layout: archives
toc: false
---

View File

@@ -0,0 +1,5 @@
---
title: 归档
layout: archives
toc: false
---

View File

@@ -13,4 +13,5 @@ next: /docs/advanced/multi-language
{{< card link="multi-language" title="چندزبانه" icon="translate" >}}
{{< card link="customization" title="سفارشی‌سازی" icon="pencil" >}}
{{< card link="comments" title="سیستم نظرات" icon="chat-alt" >}}
{{< /cards >}}
{{< card link="additional-pages" title="صفحات اضافی" icon="library" >}}
{{< /cards >}}

View File

@@ -13,4 +13,5 @@ next: /docs/advanced/multi-language
{{< card link="multi-language" title="多言語対応" icon="translate" >}}
{{< card link="customization" title="カスタマイズ" icon="pencil" >}}
{{< card link="comments" title="コメントシステム" icon="chat-alt" >}}
{{< /cards >}}
{{< card link="additional-pages" title="追加ページ" icon="library" >}}
{{< /cards >}}

View File

@@ -13,5 +13,5 @@ This section covers some advanced topics of the theme.
{{< card link="multi-language" title="Multi-language" icon="translate" >}}
{{< card link="customization" title="Customization" icon="pencil" >}}
{{< card link="comments" title="Comments System" icon="chat-alt" >}}
{{< card link="glossary" title="Glossary" icon="library" >}}
{{< card link="additional-pages" title="Additional Pages" icon="library" >}}
{{< /cards >}}

View File

@@ -13,4 +13,5 @@ next: /docs/advanced/multi-language
{{< card link="multi-language" title="多语言支持" icon="translate" >}}
{{< card link="customization" title="自定义配置" icon="pencil" >}}
{{< card link="comments" title="评论系统" icon="chat-alt" >}}
{{< /cards >}}
{{< card link="additional-pages" title="附加页面" icon="library" >}}
{{< /cards >}}

View File

@@ -1,18 +1,22 @@
---
title: "واژه‌نامه"
title: "صفحات اضافی"
weight: 1
prev: /docs/advanced
aliases:
- /docs/advanced/glossary/
---
Hextra از ایجاد واژه‌نامهٔ اصطلاحات در سطح کل سایت پشتیبانی می‌کند.
Hextra چند صفحهٔ اضافی دارد که باید به‌صورت جداگانه فعال شوند: واژه‌نامه و آرشیو.
<!--more-->
## واژه‌نامه
{{< callout type="info" >}}
برای اطلاعات بیشتر دربارهٔ پشتیبانی واژه‌نامهٔ داخلی Hugo، به [مرجع سریع واژه‌نامهٔ Hugo](https://gohugo.io/quick-reference/glossary/) مراجعه کنید.
{{< /callout >}}
## فایل دادهٔ منبع
### فایل دادهٔ منبع
تعاریف اصطلاحات به‌صورت متمرکز در فایل دادهٔ `termbase.yaml` برای هر [زبان پشتیبانی‌شده](../multi-language/) ذخیره می‌شوند.
@@ -32,9 +36,9 @@ Hextra از ایجاد واژه‌نامهٔ اصطلاحات در سطح کل
هر فایل YAML شامل فهرستی از اصطلاحات واژه‌نامه است. هر ورودی شامل موارد زیر است:
* `term`: نام کامل مفهوم یا عبارت.
* `definition`: توضیح یا شرح مختصر اصطلاح.
* `abbr` (اختیاری): مخفف یا سرواژهٔ رایج اصطلاح.
- `term`: نام کامل مفهوم یا عبارت.
- `definition`: توضیح یا شرح مختصر اصطلاح.
- `abbr` (اختیاری): مخفف یا سرواژهٔ رایج اصطلاح.
```yaml {filename="data/fa/termbase.yaml"}
- term: seo
@@ -44,7 +48,7 @@ Hextra از ایجاد واژه‌نامهٔ اصطلاحات در سطح کل
definition: "موتورهایی که ورودی متنی را پردازش کرده و صفحات وب ایستا تولید می‌کنند"
```
## صفحهٔ واژه‌نامه
### صفحهٔ واژه‌نامه
برای رندر شدن صفحهٔ نمایهٔ واژه‌نامه (که شامل فهرست تمام اصطلاحات تعریف‌شده به‌همراه توضیحات و مخفف‌های آن‌هاست)،
باید برای هر زبان پشتیبانی‌شده یک فایل محتوای واژه‌نامهٔ مخصوص همان زبان تعریف شود.
@@ -58,3 +62,44 @@ layout: glossary
```
یک صفحهٔ نمونه از واژه‌نامه در [واژه‌نامه]({{% relref "/glossary" %}}) در دسترس است.
## آرشیو
می‌توانید برای نوشته‌های یک بخش، یک صفحه آرشیو زمانی (گروه‌بندی‌شده بر اساس سال) بسازید.
1. صفحه آرشیو را ایجاد کنید:
```yaml {filename="content/archives/_index.md"}
---
title: Archives
layout: archives
toc: false
---
```
2. (اختیاری) آن را به منوی بالا اضافه کنید:
```yaml {filename="hugo.yaml"}
menu:
main:
- identifier: archives
name: Archives
pageRef: /archives
```
3. (اختیاری، چندزبانه) فایل‌های آرشیو ترجمه‌شده با همان layout اضافه کنید، برای مثال:
- `content/archives/_index.fa.md`
- `content/archives/_index.ja.md`
- `content/archives/_index.zh-cn.md`
4. (اختیاری) بخش مورد استفاده برای آرشیو را تغییر دهید. مقدار پیش‌فرض `blog` است.
```yaml {filename="hugo.yaml"}
params:
archives:
section: blog
```
5. (اختیاری) قالب نمایش تاریخ آیتم‌های آرشیو را تغییر دهید. مقدار پیش‌فرض `Jan 02` است.
```yaml {filename="hugo.yaml"}
params:
archives:
dateFormat: "Jan 02"
```
پیام حالت خالی از کلید ترجمه `noResultsFound` استفاده می‌کند.
یک صفحهٔ نمونه از آرشیو در [آرشیو]({{% relref "/archives" %}}) در دسترس است.

View File

@@ -1,18 +1,22 @@
---
title: "用語集"
title: "追加ページ"
weight: 1
prev: /docs/advanced
aliases:
- /docs/advanced/glossary/
---
Hextra は、サイト全体で使用する用語集の構築をサポートしています。
Hextra には明示的に有効化する追加ページがあります。用語集とアーカイブです。
<!--more-->
## 用語集
{{< callout type="info" >}}
Hugo の用語集サポートの詳細については、[Hugo 用語集クイックリファレンス](https://gohugo.io/quick-reference/glossary/)をご覧ください。
{{< /callout >}}
## データソースファイル
### データソースファイル
用語の定義は、各[対応言語](../multi-language/)ごとに `termbase.yaml` データファイルに一元管理されています。
@@ -32,9 +36,9 @@ Hextra は、サイト全体で使用する用語集の構築をサポートし
各 YAML データファイルには、用語の一覧が含まれています。各エントリには以下が含まれます:
* `term`:概念やフレーズの正式名称。
* `definition`:用語の簡潔な説明。
* `abbr`(任意):一般的に使用される略語や頭字語。
- `term`:概念やフレーズの正式名称。
- `definition`:用語の簡潔な説明。
- `abbr`(任意):一般的に使用される略語や頭字語。
```yaml {filename="data/ja/termbase.yaml"}
- term: seo
@@ -44,7 +48,7 @@ Hextra は、サイト全体で使用する用語集の構築をサポートし
definition: "テキスト入力を処理して静的なウェブページを生成するソフトウェアエンジン"
```
## 用語ページ
### 用語ページ
定義済みの用語、その説明、および略語を一覧表示するグロッサリーのインデックスページをレンダリングするには、
サポートされている各言語ごとに、言語固有のグロッサリー用コンテンツファイルを定義する必要があります。
@@ -58,3 +62,44 @@ layout: glossary
```
グロッサリーのサンプルページは [用語集]({{% relref "/glossary" %}}) で確認できます。
## アーカイブ
投稿を年ごとにまとめたアーカイブタイムラインページを作成できます。
1. アーカイブページを作成します:
```yaml {filename="content/archives/_index.md"}
---
title: Archives
layout: archives
toc: false
---
```
2. (任意)トップメニューに追加します:
```yaml {filename="hugo.yaml"}
menu:
main:
- identifier: archives
name: Archives
pageRef: /archives
```
3. (任意・多言語)同じ layout を使った翻訳版アーカイブページを追加します。例:
- `content/archives/_index.fa.md`
- `content/archives/_index.ja.md`
- `content/archives/_index.zh-cn.md`
4. (任意)アーカイブ対象のセクションを変更します。デフォルトは `blog` です。
```yaml {filename="hugo.yaml"}
params:
archives:
section: blog
```
5. (任意)アーカイブ項目の日付表示形式を変更します。デフォルトは `Jan 02` です。
```yaml {filename="hugo.yaml"}
params:
archives:
dateFormat: "Jan 02"
```
空状態メッセージは i18n キー `noResultsFound` を使用します。
アーカイブのサンプルページは [アーカイブ]({{% relref "/archives" %}}) で確認できます。

View File

@@ -1,18 +1,22 @@
---
title: "Glossary"
title: "Additional Pages"
weight: 1
prev: /docs/advanced
aliases:
- /docs/advanced/glossary/
---
Hextra supports building a site-wide terminology glossary.
Hextra includes additional pages that you can enable explicitly: glossary and archives.
<!--more-->
## Glossary
{{< callout type="info" >}}
For more information about Hugo's built-in glossary support, see the [Hugo Glossary Quick Reference](https://gohugo.io/quick-reference/glossary/).
{{< /callout >}}
## Source Data File
### Source Data File
Term definitions are centrally stored in a `termbase.yaml` data file for each [supported language](../multi-language/).
@@ -32,9 +36,9 @@ Term definitions are centrally stored in a `termbase.yaml` data file for each [s
Each YAML data file contains a list of glossary entries. Every entry includes:
* `term`: The full name of the concept or phrase.
* `definition`: A brief explanation or description of the term.
* `abbr` (optional): A commonly used abbreviation or acronym for the term.
- `term`: The full name of the concept or phrase.
- `definition`: A brief explanation or description of the term.
- `abbr` (optional): A commonly used abbreviation or acronym for the term.
```yaml {filename="data/en/termbase.yaml"}
- term: seo
@@ -44,7 +48,7 @@ Each YAML data file contains a list of glossary entries. Every entry includes:
definition: "Software engines processing text input to generate static web pages"
```
## Glossary Page
### Glossary Page
To render the glossary index page (listing all defined terms along with their descriptions and abbreviations),
a language-specific glossary content file must be defined for each supported language. Use the language code suffix
@@ -58,3 +62,44 @@ layout: glossary
```
An example glossary page is available at [Glossary]({{% relref "/glossary" %}}).
## Archives
You can create an archive timeline page (grouped by year) for posts in a section.
1. Create the archive page:
```yaml {filename="content/archives/_index.md"}
---
title: Archives
layout: archives
toc: false
---
```
2. (Optional) Add it to the top menu:
```yaml {filename="hugo.yaml"}
menu:
main:
- identifier: archives
name: Archives
pageRef: /archives
```
3. (Optional, multilingual) Add translated archive index pages with the same layout, for example:
- `content/archives/_index.fa.md`
- `content/archives/_index.ja.md`
- `content/archives/_index.zh-cn.md`
4. (Optional) Change the content section used for archives. The default is `blog`.
```yaml {filename="hugo.yaml"}
params:
archives:
section: blog
```
5. (Optional) Change the archive item date format. The default is `Jan 02`.
```yaml {filename="hugo.yaml"}
params:
archives:
dateFormat: "Jan 02"
```
The empty-state message uses the `noResultsFound` i18n key.
An example archive page is available at [Archives]({{% relref "/archives" %}}).

View File

@@ -1,18 +1,22 @@
---
title: "术语表"
title: "附加页面"
weight: 1
prev: /docs/advanced
aliases:
- /docs/advanced/glossary/
---
Hextra 支持构建全站范围的术语词汇表
Hextra 提供一些需要单独启用的附加页面:术语表与归档页
<!--more-->
## 术语表
{{< callout type="info" >}}
有关 Hugo 内置术语表支持的更多信息,请参阅 [Hugo 术语表快速参考](https://gohugo.io/quick-reference/glossary/)。
{{< /callout >}}
## 数据源文件
### 数据源文件
术语定义集中存储在每种[支持语言](../multi-language/)的 `termbase.yaml` 数据文件中。
@@ -32,9 +36,9 @@ Hextra 支持构建全站范围的术语词汇表。
每个 YAML 数据文件包含一组术语条目。每个条目包括:
* `term`:术语或短语的完整名称。
* `definition`:对术语的简要解释或描述。
* `abbr`(可选):术语常用的缩写或首字母缩写。
- `term`:术语或短语的完整名称。
- `definition`:对术语的简要解释或描述。
- `abbr`(可选):术语常用的缩写或首字母缩写。
```yaml {filename="data/zh-cn/termbase.yaml"}
- term: seo
@@ -44,7 +48,7 @@ Hextra 支持构建全站范围的术语词汇表。
definition: "将文本输入处理为静态网页的生成引擎"
```
## 术语页面
### 术语页面
要渲染词汇表索引页面(列出所有已定义的术语及其说明和缩写),
必须为每种受支持的语言定义一个对应的语言专用词汇表内容文件。
@@ -58,3 +62,44 @@ layout: glossary
```
示例词汇表页面可在 [术语表]({{% relref "/glossary" %}}) 查看。
## 归档页
你可以为某个内容分区的文章创建按年份分组的归档时间线页面。
1. 创建归档页面:
```yaml {filename="content/archives/_index.md"}
---
title: Archives
layout: archives
toc: false
---
```
2. (可选)将其添加到顶部菜单:
```yaml {filename="hugo.yaml"}
menu:
main:
- identifier: archives
name: Archives
pageRef: /archives
```
3. (可选,多语言)添加使用相同 layout 的多语言归档首页,例如:
- `content/archives/_index.fa.md`
- `content/archives/_index.ja.md`
- `content/archives/_index.zh-cn.md`
4. (可选)修改归档来源分区。默认值为 `blog`
```yaml {filename="hugo.yaml"}
params:
archives:
section: blog
```
5. (可选)修改归档条目的日期显示格式。默认值是 `Jan 02`
```yaml {filename="hugo.yaml"}
params:
archives:
dateFormat: "Jan 02"
```
空状态文案使用 i18n 键 `noResultsFound`
示例归档页面可在 [归档]({{% relref "/archives" %}}) 查看。

View File

@@ -1,7 +1,7 @@
---
title: "Multi-language"
weight: 1
prev: /docs/advanced/glossary
prev: /docs/advanced/additional-pages
---
Hextra supports creating site with multiple languages using Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/).

View File

@@ -5,7 +5,7 @@ next: /docs/guide/deploy-site
یک مؤلفهٔ داخلی برای نمایش تعریف اصطلاحات.
تعاریف اصطلاحات در یک [فایل دادهٔ YAML](/docs/advanced/glossary#source-data-file) ساختاریافته نگهداری می‌شوند،
تعاریف اصطلاحات در یک [فایل دادهٔ YAML](/docs/advanced/additional-pages) ساختاریافته نگهداری می‌شوند،
و برای هر زبان پشتیبانی‌شده یک فایل جداگانه تعریف می‌گردد.
## مثال

View File

@@ -5,7 +5,7 @@ next: /docs/guide/deploy-site
用語の定義を表示するための組み込みコンポーネントです。
用語の定義は、構造化された YAML [データファイル](/docs/advanced/glossary#source-data-file)で管理されており、
用語の定義は、構造化された YAML [データファイル](/docs/advanced/additional-pages)で管理されており、
対応する言語ごとに1つのファイルが定義されています。
## 例

View File

@@ -5,7 +5,7 @@ next: /docs/guide/deploy-site
A built-in component to display a terminology definition.
Glossary definition is maintained in a structured YAML [data file](/docs/advanced/glossary#source-data-file),
Glossary definition is maintained in a structured YAML [data file](/docs/advanced/additional-pages),
with one file defined per supported language.
## Example

View File

@@ -5,7 +5,7 @@ next: /docs/guide/deploy-site
一个用于显示术语定义的内置组件。
术语定义保存在结构化的 YAML [数据文件](/docs/advanced/glossary#source-data-file)中,
术语定义保存在结构化的 YAML [数据文件](/docs/advanced/additional-pages)中,
每种支持的语言对应一个文件。
## 示例

View File

@@ -102,19 +102,18 @@ menu:
weight: 1
- identifier: versions
name: Versions
weight: 2
weight: 5
- identifier: blog
name: Blog
pageRef: /blog
weight: 3
- identifier: about
name: About
pageRef: /about
weight: 2
- identifier: more
name: More
weight: 4
- identifier: showcase
name: Showcase
pageRef: /showcase
weight: 5
weight: 3
params:
type: link
icon: collection
@@ -142,6 +141,21 @@ menu:
name: v0.9 ↗
url: https://imfing.github.io/hextra/versions/v0.9/
parent: versions
- identifier: about
name: About
pageRef: /about
parent: more
weight: 1
- identifier: archives
name: Archives
pageRef: /archives
parent: more
weight: 2
- identifier: glossary
name: Glossary
pageRef: /glossary
parent: more
weight: 3
sidebar:
- identifier: more
@@ -226,6 +240,12 @@ params:
article:
displayPagination: true
archives:
# Source section used for the archives page.
section: blog
# Date format for archive list items.
dateFormat: "Jan 02"
toc:
displayTags: true

View File

@@ -101,6 +101,7 @@
"footnote-ref",
"footnotes",
"frac-line",
"hextra-archive-timeline",
"hextra-badge",
"hextra-banner",
"hextra-banner-close-button",
@@ -314,6 +315,7 @@
"hx:dark:hover:text-gray-300",
"hx:dark:hover:text-gray-50",
"hx:dark:hover:text-neutral-50",
"hx:dark:hover:text-primary-400",
"hx:dark:hover:text-white",
"hx:dark:opacity-80",
"hx:dark:placeholder:text-gray-400",
@@ -347,6 +349,7 @@
"hx:data-[state=selected]:dark:text-primary-600",
"hx:data-[state=selected]:text-primary-600",
"hx:decoration-from-font",
"hx:duration-150",
"hx:duration-200",
"hx:duration-75",
"hx:ease-in",
@@ -424,6 +427,7 @@
"hx:inline-flex",
"hx:inset-x-0",
"hx:inset-y-0",
"hx:items-baseline",
"hx:items-center",
"hx:items-start",
"hx:justify-between",
@@ -515,6 +519,7 @@
"hx:min-w-[18px]",
"hx:min-w-[24px]",
"hx:min-w-full",
"hx:ml-2",
"hx:ml-4",
"hx:mr-1",
"hx:mr-2",
@@ -558,6 +563,7 @@
"hx:pb-8",
"hx:pb-[env(safe-area-inset-bottom)]",
"hx:pb-px",
"hx:pl-6",
"hx:pl-[max(env(safe-area-inset-left),1.5rem)]",
"hx:placeholder:text-gray-500",
"hx:pointer-events-none",
@@ -646,6 +652,7 @@
"hx:sm:w-[110%]",
"hx:sr-only",
"hx:sticky",
"hx:tabular-nums",
"hx:text-2xl",
"hx:text-4xl",
"hx:text-[.65rem]",