Skip to content

General

This page discusses configuration for the top-level configuration of the Starlight Site Graph plugin. The general configuration can only be set in the astro.config.mjs file.

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightSiteGraph from 'starlight-site-graph'
export default defineConfig({
integrations: [
starlight({
plugins: [starlightSiteGraph({
debug: boolean,
overridePageSidebar: boolean,
graph: boolean,
backlinks: boolean,
trackVisitedPages: 'disable' | 'session' | 'local',
})],
}),
],
})

The debug option is a boolean that enables or disables debug mode. When enabled, more internal stats will be logged, and a performance graph will be shown on the page, visualizing the current performance of the graph in FPS.

The overridePageSidebar option is a boolean that enables or disables the <PageSidebar> override, removing the <PageGraph> and <PageBacklinks> components from the sidebar, and using the vanilla or another overridden Starlight sidebar instead. This flag is enabled by default, and unless you are planning to move the <PageGraph> and <PageBacklinks> components to another location on the page, you probably want to keep it enabled.

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightSiteGraph from 'starlight-site-graph'
export default defineConfig({
integrations: [
starlight({
plugins: [starlightSiteGraph({
overridePageSidebar: false
})],
title: 'My Docs',
}),
],
})

If you want to completely disable the graph from appearing anywhere, including the page sidebar, you can do so by setting graph to false in the plugin settings. This setting is equivalent to setting the visibilityRules option to [] for the <PageGraph> component.

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightSiteGraph from 'starlight-site-graph'
export default defineConfig({
integrations: [
starlight({
plugins: [starlightSiteGraph({
graph: false
})],
title: 'My Docs',
}),
],
})

If you want to completely disable the backlinks from appearing anywhere, including the page sidebar, you can do so by setting backlinks to false in the plugin settings. This setting is equivalent to setting the visibilityRules option to [] for the <PageBacklinks> component.

astro.config.mjs
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightSiteGraph from 'starlight-site-graph'
export default defineConfig({
integrations: [
starlight({
plugins: [starlightSiteGraph({
backlinks: false
})],
title: 'My Docs',
}),
],
})

The trackVisitedPages option is a string that enables or disables tracking of visited pages, and the location where the visited pages are stored. The possible options are:

  • disable: The visited pages are not stored.
  • session: The visited pages are stored in the session storage.
  • local: The visited pages are stored in the local storage.

By default, the visited pages are stored in session storage, meaning they are lost when the browser is closed. The data is stored under the starlight-site-graph--visited-pages key.