Skip to main content

Backlinks

Published:

Yore embeds a backlink system based on jmooring/hugo-module-backlinks to track and display bidirectional links.

Configuration

Add backlinks to outputs.home to generate the backlink index, and set backlinkEnabled: true to display backlinks on pages:

hugo.yaml
outputs:
  home:
    - HTML
    - RSS
    - backlinks
params:
  backlinkEnabled: true
Note

Backlinks rely on global state. Restart the development server to see updated references.

Backlinks are only detected when the link path can be resolved by Hugo's .GetPage. Use paths relative to the current file or the content directory root.

For example, with this directory structure:

content/
├── docs/
│   ├── installation
│   │   └── index.md
│   └── usage.md
└── posts/
    └── feature-update.md

In docs/installation/index.md, you can reference the other content using:

  • [text](../usage.md)
  • [text](/posts/feature-update.md) or [text](../../posts/feature-update.md)

And in docs/usage.md, you can reference the other content using:

  • [text](./installation/index.md)
  • [text](/posts/feature-update.md) or [text](../posts/feature-update.md)
Caution

Paths that cannot resolve by Hugo's GetPage are ignored and will not be indexed.

How It Works

During rendering, Hugo's render-link hook intercepts each internal link and calls .GetPage on the destination path. If the path resolves to a page, a backlink entry is recorded in a global store that is built once per site build.

Article Connections