Skip to main content

Backlinks

View Source Edit this page (external link)
Published:

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

Configuration Link to this heading

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

hugo.yaml
outputs:
  home:
    # The original outputs
    - html
    - rss
    # Add this line
    - backlinks
params:
  pageShowBacklinks: true

Backlinks are only detected when the link path can be resolved by Hugo's .GetPage. Simply put, you should always use syntax that includes the file extension (.md). This way, if resolution fails, you'll immediately notice that the link path includes .md, and your IDE will also be able to correctly recognize the file, enabling the jump-to-article feature to work properly.

It's recommended to use this alongside rumdl (external link). The MD057 (external link) rule can check the correctness of your links, and even supports custom root directories, allowing you to write content/posts/p1.md as /posts/p1.md while still having it checked correctly.

How It Works Link to this heading

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

Accessibility settings

Font size