# Knowledge Graph

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

Knowledge Graph visualizes [backlink][backlink] and taxonomy relationships between articles as an interactive graph. Yore supports [Hugo Knowledge Graph][hkg] with no additional HTML/CSS configuration.

## Installation & Configuration

Pick one of these methods to set up.

### Git Submodule

```bash
git submodule add https://github.com/ZhenShuo2021/hugo-knowledge-graph themes/hugo-knowledge-graph
```

Configure `hugo.yaml`:

```yaml
theme:
  - hugo-knowledge-graph
  - hugo-yore

outputs:
  home:
    # The original outputs
    - html
    - rss
    # Add this lines
    - backlinks
    - knowledge-graph

params:
  pageKgStyle: bottom # bottom | sidebar | disable
```

### Hugo Module

Make sure your project already uses Hugo modules. If not, run `hugo mod init NAME` first.

Configure `hugo.yaml`:

```yaml
module:
  imports:
    - path: github.com/ZhenShuo2021/hugo-yore
    - path: github.com/ZhenShuo2021/hugo-knowledge-graph

outputs:
  home:
    # The original outputs
    - html
    - rss
    # Add this lines
    - backlinks
    - knowledge-graph

params:
  pageKgStyle: bottom # bottom | sidebar | disable
```

> [!NOTE]
> Yore already includes Hugo's embedded link render hook, so you do not need to set `useEmbedded = "always"`.

## Usage

`pageKgStyle` controls where the knowledge graph widget appears. `bottom` places it at the bottom of the page. `sidebar` places it above the ToC.

Creating `content/graph/_index.md` will generate the full version of the knowledge graph, including legend filters and search functionality.

For detailed configuration, refer to the [Hugo Knowledge Graph][hkg] README.

[hkg]: https://github.com/ZhenShuo2021/hugo-knowledge-graph
[backlink]: /docs/200-features/360-backlinks/index.md




## 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
