快轉到主要內容

Page Actions

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

page-actions.js (外部連結) page-actions.html (外部連結)

Page actions add a per-page dropdown menu with utilities for sharing and inspecting content.

Configuration 此標題的連結

All keys go under params in hugo.yaml. pageShowActions can also be set per-page in front matter.

KeyTypeDescription
pageShowActionsboolShow the page actions menu
repoURLstringBranch root URL, enables View Repo Source
repoSubdirstringPath from repo root to Hugo project directory; set when the Hugo project is not at the repo root

repoURL must point to the branch root, not the repository root. For example:

hugo.yaml
params:
  pageShowActions: true
  repoURL: https://github.com/example/my-site/blob/main
  repoSubdir: exampleSite  # omit if Hugo project is at repo root

Actions 此標題的連結

Some actions are always available. Others require additional configuration to activate.

ActionCondition
Copy URLAlways present
Copy MarkdownRequires markdown in page outputs
View SourceRequires markdown in page outputs
View Repo SourceRequires repoURL

Copy Markdown and View Source serve the raw Markdown of the current page. Set the markdown output in hugo.yaml:

hugo.yaml
outputs: # Custom output formats per page type
  home:
    - HTML
    - RSS
    - backlinks
    - knowledge-graph
+   - markdown
  section:
    - HTML
    - RSS
+   - markdown
  page:
    - HTML
+   - markdown

文章關聯

無障礙設定