From 9c547b4a9f501a140aa200817efb195e191cac60 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sat, 7 Sep 2024 18:29:46 +0200 Subject: [PATCH] fix: make the metadata for documentation pages dynamically generated --- theme.config.tsx | 75 ++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/theme.config.tsx b/theme.config.tsx index 26885ab..40e5c05 100644 --- a/theme.config.tsx +++ b/theme.config.tsx @@ -1,39 +1,52 @@ import { useRouter } from "next/router"; +import { useConfig } from "nextra-theme-docs"; import Logo from "./components/shared/Logo"; export default { - head: ( - <> - - + head: function Head() { + const { asPath, defaultLocale, locale } = useRouter(); + const { frontMatter } = useConfig(); + const url = `https://svrjs.org/${asPath}`; - - - - - - Documentation - SVR.JS - - - - - - ), + return ( + <> + + + + + + + + + {(frontMatter.title || "Documentation") + " - SVR.JS"} + + + + + + ); + }, editLink: { component: null },