Fix TOC links

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-05-07 21:03:40 +02:00
parent d257a0f26e
commit 25fb5a4bf0
+3 -3
View File
@@ -6,7 +6,7 @@ import NoteTOC from "../../components/NoteTOC.astro";
import NoteNavSidebar from "../../components/NoteNavSidebar.astro"; import NoteNavSidebar from "../../components/NoteNavSidebar.astro";
import NoteGraphSidebar from "../../components/NoteGraphSidebar.astro"; import NoteGraphSidebar from "../../components/NoteGraphSidebar.astro";
import NoteVars from "../../components/NoteVars.svelte"; import NoteVars from "../../components/NoteVars.svelte";
import { getCategory, extractLinks, extractExternalLinks, extractHeadings } from "../../utils/notes"; import { getCategory, extractLinks, extractExternalLinks } from "../../utils/notes";
export async function getStaticPaths() { export async function getStaticPaths() {
const notes = await getCollection("notes"); const notes = await getCollection("notes");
@@ -17,7 +17,7 @@ export async function getStaticPaths() {
} }
const { entry } = Astro.props; const { entry } = Astro.props;
const { Content } = await render(entry); const { Content, headings: astroHeadings } = await render(entry);
const allNotes = await getCollection("notes"); const allNotes = await getCollection("notes");
const sortedNotes = allNotes.sort((a, b) => const sortedNotes = allNotes.sort((a, b) =>
@@ -60,7 +60,7 @@ const noteVars = [
), ),
]; ];
const headings = extractHeadings(entry.body ?? ""); const headings = astroHeadings.map((h) => ({ depth: h.depth, text: h.text, id: h.slug }));
const externalLinks = extractExternalLinks(entry.body ?? ""); const externalLinks = extractExternalLinks(entry.body ?? "");
--- ---