Graph View
An interactive graph of your pages.
@vuesho/graph-view draws your pages as nodes and the links between them as edges. Hover a node to see its description and highlight its links, and click it to open the page:
Setup
Install the Package
npm i @vuesho/graph-viewAdd the Plugin
graphViewPlugin() builds a graph of the pages in each language:
import { graphViewPlugin } from "@vuesho/graph-view";
import { createSite, recommendedPreset } from "vuesho/config";
export default createSite(docs.toSource()).plugins(
recommendedPreset(),
graphViewPlugin(),
);Show the Graph
Add <SiteGraph /> to any page:
---
title: Map of the Docs
---
<SiteGraph />Links in the Graph
The graph has an edge for each Markdown link to another page, written as a URL like /guide/install or a file like ./install.md. Links in HTML and in component props, like a <Card>'s href, aren't in the graph.
Pages from every content source are in the graph. The graph loads in the browser, so a page with <SiteGraph /> has no graph in its HTML or its Markdown.
Customizing the Graph
SiteGraph's default slot receives { graph }, with the graph's nodes and links, empty on the server and until the graph loads. Each node has a text, a description and a url.
To change how the graph is drawn, copy the drawing code into your project with vuesho add:
npx vuesho add components/graph-view --from @vuesho/graph-viewThen write a component that passes the graph to the copy:
<script setup lang="ts">
import { SiteGraph } from "@vuesho/graph-view/client";
import { GraphView } from "../../ui/@vuesho/graph-view/components/graph-view";
</script>
<template>
<SiteGraph v-slot="{ graph }">
<GraphView :graph="graph" />
</SiteGraph>
</template>