Skip to content

Repository links and page info

Connect “edit this page”, “open an issue”, and “view history” to your repository. Show last-modified information, contributors, and feedback at the page end.

Point OINK at the Git repository that holds your content to give readers an edit link and a way to report documentation problems.

For a public forge whose content is on main, set one value in hugo.yml.

hugo.yml
params:
  repo: https://github.com/pgsty/oink.pgsty.com

The navbar and Command Palette open the repository. On this GitHub page the action menu opens the editor for content/docs/customize/repository.md, its file history, the new-file form in the same directory, and a docs issue with the page title. OINK builds these links offline.

If your site needs a different branch, use the map form.

hugo.yml
params:
  repo:
    url: https://gitlab.com/example/docs
    branch: release/1.8

Add subdir: website if your Hugo site lives in website/. Add project_url only if product bugs belong in a separate repository. This enables Create project issue and makes the navbar and Palette open the product repository. label sets the name on both controls.

Existing Docsy sites can keep github_repo, github_project_repo, github_branch, github_subdir and path_base_for_github_subdir. These URLs use GitHub routes, including on GitHub Enterprise. Set repo to opt into host detection.

Supported platforms and self-hosted forges

Platform Recognized hosts Create child page
GitHub github.com Prefilled new-file form
GitLab gitlab.com, jihulab.com Omitted by default
Gitea gitea.com New-file form in the source directory
Forgejo codeberg.org New-file form in the source directory
Gitee gitee.com Omitted by default
GitCode gitcode.com Omitted by default

On GitLab, a branch such as release/1.8 is encoded as release%2F1.8 in edit and history links. Gitee opens the issue form without prefilling its title.

For a self-hosted instance, add just the platform name.

hugo.yml
params:
  repo:
    url: https://git.corp.example/team/docs
    platform: gitlab

A product on the same host shares the platform. For a different self-hosted product, set project_platform. An unknown host with no matching configuration gets a build warning and a working repository home link.

For a forge with different routes, specify only the actions it supports.

hugo.yml
params:
  repo:
    url: https://bitbucket.org/acme/docs
    platform: custom
    urls:
      edit: '{repo}/src/{branch}/{path}?mode=edit'
      history: '{repo}/history-node/{branch}/{path}'
      commit: '{repo}/commits/{hash}'

Templates start with a fixed HTTP(S) host or the action’s repository placeholder. Path and query values are escaped in place. An action still needs its normal inputs, such as a mapped file for Edit or a known commit for the last-modified link. The shell contract lists the routes and placeholders.

A page or a matching section or version cascade can override individual site fields. Hugo selects one page-level repo value, so put fields shared across nested cascades in the site configuration. For per-language site overrides, use the same map form at both levels. For example, this version only changes the branch.

hugo.yml
cascade:
  - target:
      sites:
        matrix:
          versions: [v1.8]
    params:
      repo:
        branch: release/1.8

Content from another repository

When a section is copied or mounted from an upstream repository, its edit and history links should lead to that repository. Override the repository keys in the section’s cascade, and use repo.path_base (or path_base_for_github_subdir) to strip or replace the prefix of each page’s source path before it is appended to subdir. Switching url to another host re-infers the platform automatically unless you also set platform. For files copied into the site, that path is relative to the site root:

content/reference/_index.md
---
title: Upstream reference
cascade:
  repo:
    url: https://github.com/OWNER/UPSTREAM
    subdir: docs
    path_base: '^content/reference/'
---

content/reference/api/client.md then maps to docs/api/client.md upstream.

For a directory mounted from outside the site, match its absolute source path, not the mount target inside Hugo. Paths are compared with / separators on every platform, Windows included, and keep their filename case:

External source at /srv/upstream/docs/
repo:
  path_base: '^/srv/upstream/docs/'

With subdir: docs, /srv/upstream/docs/api/client.md maps to docs/api/client.md. The result must be a non-empty path inside the repository. When an external file matches no mapping, or the result is absolute, starts with a drive letter, is . or climbs out with .., the page gets no Edit, View edit history or Create child page entry; its issue links still follow their own repository settings.

path_base (and path_base_for_github_subdir) is a regular expression. When upstream files have different names from the local ones, give a from / to pair instead; this maps each section’s _index.md to the upstream README.md:

content/reference/_index.md
cascade:
  repo:
    path_base:
      from: '^content/reference/(.*/)?_index(\.zh)?\.md$'
      to: '${1}README${2}.md'

OINK keeps .md and .zh.md side by side in one directory, so both languages share a path prefix and the expression needs no language directory. After changing it, click Edit this page on a leaf page and on a section index, in every language: an expression that strips too much produces URLs that look right and return 404.

Turning individual entries off

Set any entry under params.repo.urls to false to disable it cleanly across the page action menu, the command palette and keyboard shortcuts:

hugo.yml
params:
  repo:
    url: https://github.com/OWNER/DOCS
    urls:
      create_child: false

The same setting works in a section cascade or a page’s front matter, and repo: false in front matter removes all repository links for that page. To drop the whole page action menu from one page, set page_context_menu: false in its front matter; see Page parameters.

On GitHub, Create child page opens a new file prefilled from the theme’s assets/stubs/new-page-template.md. Put your own file at the same path in your site, assets/stubs/new-page-template.md, to prefill your own skeleton.

Last modified

The last-modified line comes from Git history, not file modification times, which a checkout resets. Turn on Hugo’s Git support:

hugo.yml
enableGitInfo: true
params:
  repo: https://github.com/pgsty/oink.pgsty.com
  ui:
    lastmod_commit: subject # subject | hash | none

The end of the page then reads “Last modified August 17, 2026 · (a1b2c3d)”, and the commit part links to the platform’s commit page (…/commit/<hash>, …/-/commit/<hash> on GitLab, or your repo.urls.commit template). A copied page can point its editor upstream while its commit and downstream change history point to the site’s content repository. An external mount with no verified local commit shows just the date when available.

lastmod_commit controls the commit text.

Value What is shown
subject (default) The commit subject plus the abbreviated hash
hash commit a1b2c3d
none The date only, with no commit link

Any other value warns (invalid params.ui.lastmod_commit) and uses subject.

In CI, set fetch-depth: 0 on the checkout step: a shallow clone, the default in GitHub Actions, contains only the latest commit, so every page shows that commit’s date or none at all. Deploy has the complete workflows. A file you have not committed yet has no Git date, so a new page previewed locally shows no last-modified line. If your build has no Git history at all, leave the line off rather than substituting the build time, which says nothing about when the content changed.

The line belongs to the page’s annotation block, which is on by default; annotation: false turns the block off for one page. The same block also shows where a page came from, driven by its front matter with no template override:

  • Upstream attribution: on a page derived from someone else’s work, set upstream_link with the four required keys upstream_name, upstream_copyright, upstream_license and upstream_notice. The page end then names the work, its copyright holder and license, and links to the full notice. Add upstream_modified: true to say the page was changed downstream.
  • Translation notice: set params.ui.translation_notice to the language code of the authoritative version, and translated pages link back to the original. A page written natively in its own language opts out with translation_notice: false.

Both families are defined in full in Page parameters. To change the block itself, override the narrowest of three partials:

layouts/_partials/annotation-items.html
Add, remove or reorder the lines, keeping the theme’s markup, icons, print rules and accessible label
layouts/_partials/page-meta-lastmod.html
Replace the markup those lines render as
layouts/_partials/page-annotation.html
Replace the block’s outer container

What the page end is made of

Every reading layout ends a page with the same five blocks, always in this order:

Order Component Theme default Page switch
1 Share Off (params.ui.share is empty) share: false, or the page’s own list
2 Feedback Off feedback: true / false
3 Annotation On annotation: false
4 Pager On for docs / book / blog pager: false
5 Comments On when fully configured comments: false

The order follows what a reader does after the last paragraph: pass the page on, say whether it helped, check where it came from, move to the next page, join the discussion. Share comes first because a reader who wants to pass a page on has decided that before being asked whether it helped. The share bar is configured in Writing a blog, the pager in Navigation and menus, and comments in Comments.

The feedback widget

The feedback widget asks “Was this page helpful?” with Yes and No buttons, and after No offers four optional reasons, so you learn which pages fail readers without running a survey. It is off by default:

hugo.yml
params:
  ui:
    feedback:
      enable: true
      reasons: true # whether to ask for a reason after "no"

A blog usually keeps just comments, so you may prefer to turn the widget on for the documentation section only, with a cascade:

content/docs/_index.md
---
title: Docs
cascade:
  feedback: true
---
  • One click completes it: there is no text box, no submit button and no sign-in.
  • The browser keeps the choice in localStorage per page and language, so a returning reader sees it and can change it.
  • When the site has Google Analytics (gtag), the widget sends a docs_feedback event with result (solved / not_solved), page_path and language. Choosing a reason sends a second event that adds reason and refinement: true, so it is not counted twice. Without analytics the widget still works and reports nothing; it needs no backend.
  • When the page has comments, an “Add details in the comments” link appears under the answer. The widget never writes a comment on the reader’s behalf.

This page turns the widget on in its front matter, so you can try it at the end of the page.

The contributor wall

The contributors shortcode shows a grid of GitHub avatars for the people behind a project. It reads a file in your site’s data/ directory and never contacts GitHub at build time:

data/contributors.yaml
items:
  - github: Vonng
    name: Ruohang Feng
    role: Theme author
  - github: pgsty
    name: Pigsty
    role: Project organization
  - github: gohugoio
    role: Static site generator
    avatar: /icons/logo.svg
Source
{{< contributors >}}
  • github is required and must be a valid GitHub username; a repeated username warns and is skipped.
  • name defaults to the username, and role is optional.
  • url defaults to https://github.com/<github>.
  • avatar is optional. Without it the entry shows an initial and the page makes no network request; with it, the value must be an http(s):// URL or a path from the site root.

For several lists, keep one data file per list and name it with data=; class= adds classes for your own CSS:

Source
{{< contributors data="maintainers" >}}

In Markdown and RSS output, the grid becomes a list of - [@handle](url) — role lines.

This site has no data/contributors.yaml

The example therefore does not render on this page. Add a data file to data/ to render it.

Verify

From your site’s root, build and list the action links of a page whose source belongs to the configured repository. Replace the example path with one of your own pages:

hugo --printPathWarnings
PAGE=public/docs/getting-started/index.html
test -f "$PAGE" && grep -o '<a[^>]*data-td-action[^>]*>' "$PAGE"
  • The link with data-td-action="edit_page" points to your platform’s edit route (…/edit/<branch>/<source path>, …/-/edit/… on GitLab, or …/_edit/… on Gitea/Forgejo), and every segment of the source path matches the real file.
  • Platforms that omit child-page creation (such as GitLab, Gitee and GitCode) emit no data-td-action="create_child_page" link.
  • A section index (_index.md) gets a correct source path too.
  • The page end shows a last-modified line whose commit link opens the site’s content repository when Hugo has Git information for the file.
  • Page parameters — repo / annotation / feedback / pager / page_context_menu and the other page switches
  • Configuration — full definitions of repo.*, github_*, ui.lastmod_commit and ui.feedback
  • Comments — the last block at the page end
  • Analytics and SEO — where feedback events are sent
  • AI-agent support — the Markdown and assistant entries in the action menu

Was this page helpful?