# Backlinks

{{< badge
  text="render-link.backlinks.json"
  url="https://github.com/ZhenShuo2021/hugo-yore/blob/main/layouts/_markup/render-link.backlinks.json"
  variant="muted"
  appearance="accent"
  pill=true
>}}
{{< badge
  text="home.backlinks.json"
  url="https://github.com/ZhenShuo2021/hugo-yore/blob/main/layouts/home.backlinks.json"
  variant="muted"
  appearance="accent"
  pill=true
>}}

Yore embeds a backlink system based on [jmooring/hugo-module-backlinks](https://github.com/jmooring/hugo-module-backlinks) to track and display bidirectional links.

## Configuration

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

```yaml {title="hugo.yaml"}
outputs:
  home:
    # The original outputs
    - html
    - rss
    # Add this line
    - backlinks
params:
  pageShowBacklinks: true
```

## Link Resolution

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](https://github.com/rvben/rumdl). The [MD057](https://rumdl.dev/md057/) 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

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.




## Ancestors of This Page (Auto Generated)



- https://yore.zsl0621.cc/zh-tw/docs/features/index.md

- https://yore.zsl0621.cc/zh-tw/docs/index.md
