快轉到主要內容

Authors

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

Authors are modeled as a taxonomy (外部連結). Each author has a dedicated content directory with a profile page, and posts reference authors by slug.

Configuration 此標題的連結

Register the author taxonomy in hugo.yaml:

hugo.yaml
taxonomies:
  author: authors

Author Profiles 此標題的連結

Create a directory for each author under content/authors/. The directory name becomes the author's slug.

content/
└── authors/
    ├── _index.md
    └── alice/
        └── _index.md

Each author's _index.md supports the following front matter:

content/authors/alice/_index.md
---
title: Alice Chen
params:
  description: "A short bio shown on the author profile page."
  siteAuthor: true
  portrait: /img/alice.jpg
  links:
    - github: https://github.com/alice
    - x-twitter: https://example.com
---

Extended bio written in Markdown appears below the banner on the author page.
FieldDescription
titleDisplay name
params.descriptionShort bio shown in the profile banner
params.siteAuthorMark one author as the site author
params.portraitPath to portrait image
params.linksList of social links, each a single-key map of platform to URL

Social link platform names map to icons in the theme's icon set.

Assigning Authors to Posts 此標題的連結

Reference authors by identifier in the authors front matter field:

content/blog/my-post/index.md
---
title: My Post
authors: ["alice", "bob"]
---

Multiple authors are supported. Each identifier must match a directory name under content/authors/.

To show the author list in the post metadata, enable pageShowAuthors:

hugo.yaml
params:
  pageShowAuthors: true

文章關聯

無障礙設定