Repository links and page info
A reader who spots a mistake should be one click away from fixing it, and a reader who lands on a page should be able to tell how current it is. Point OINK at the GitHub repository that holds your content, and the page action menu at the right of the breadcrumb row gains Edit this page, View edit history and issue links, while the end of each page shows when it last changed and in which commit.
Configure links with four keys
With these settings, this page’s action menu points to:
| Menu entry | Target |
|---|---|
| Edit this page | …/edit/main/content/docs/customize/repository.md |
| View edit history | …/commits/main/content/docs/customize/repository.md |
| Create child page | …/new/main/content/docs/customize?filename=change-me.md&value=<template> |
| Create docs issue | …/issues/new?title=Repository links and page info |
| Create project issue | https://github.com/pgsty/oink/issues/new |
github_repois the repository that holds your content, not the theme’s; pointing it elsewhere sends readers’ fixes to the wrong place. Without it, the first four entries above are unavailable.github_project_repois optional: a second repository where readers report bugs in the product rather than in the documentation. It alone controls Create project issue, and it is also where the navbar’s GitHub button points. Leave it out if your readers would not know which repository to choose.github_branch(defaultmain) is the branch your content is edited on, not a deployment or Pages branch.github_subdiris the path from the repository root to the Hugo site. Leave it empty when the site is at the root; set it towebsitewhen the repository holds code with the site inwebsite/.
Each key can be set for the site, for one language, in a section cascade, or in a page’s front matter, so one site can draw content from several repositories. The full definitions are in Configuration.
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 path_base_for_github_subdir to strip or
replace the prefix of each page’s source path before it is appended to
github_subdir. For files copied into the site, that path is relative to the
site root:
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:
With github_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_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:
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
Every entry in the menu has a stable action ID, listed in the page action menu. When your Git host does not support an action, hide its entry with CSS:
The command palette uses the same IDs and still offers an entry hidden this
way. CSS can hide a link but cannot correct its target, so when a target is
wrong for the whole site, remove the configuration key it comes from instead.
To drop the whole menu from one page, set page_context_menu: false in its
front matter; see Page parameters.
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:
The end of the page then reads “Last modified August 17, 2026 · …/commit/<hash>.
lastmod_commit chooses that commit part:
| 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_linkwith the four required keysupstream_name,upstream_copyright,upstream_licenseandupstream_notice. The page end then names the work, its copyright holder and license, and links to the full notice. Addupstream_modified: trueto say the page was changed downstream. - Translation notice: set
params.ui.translation_noticeto 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 withtranslation_notice: false.
Both families are defined in full in Page parameters. To change the block itself, override the narrowest of three partials:
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:
A blog usually keeps just comments, so you may prefer to turn the widget on for the documentation section only, with a cascade:
- One click completes it: there is no text box, no submit button and no sign-in.
- The browser keeps the choice in
localStorageper page and language, so a returning reader sees it and can change it. - When the site has Google Analytics (
gtag), the widget sends adocs_feedbackevent withresult(solved/not_solved),page_pathandlanguage. Choosing a reason sends a second event that addsreasonandrefinement: 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:
githubis required and must be a valid GitHub username; a repeated username warns and is skipped.namedefaults to the username, androleis optional.urldefaults tohttps://github.com/<github>.avataris optional. Without it the entry shows an initial and the page makes no network request; with it, the value must be anhttp(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:
In Markdown and RSS output, the grid becomes a list of
- [@handle](url) — role lines.
data/contributors.yamlThe 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:
- The link with
data-td-action="edit_page"points togithub.com/<your repository>/edit/<branch>/<source path>, and every segment of the source path matches the real file. - A section index (
_index.md) gets a correct source path too. - The page end shows a last-modified line, except on a new page that is not committed yet.
Related
- Page parameters —
annotation/feedback/pager/page_context_menuand the other page switches - Configuration — full definitions of
github_*,ui.lastmod_commitandui.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?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)