fix: make the metadata for documentation pages dynamically generated

This commit is contained in:
Dorian Niemiec 2024-09-07 18:29:46 +02:00
parent a556cd404e
commit 9c547b4a9f

View file

@ -1,8 +1,14 @@
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}`;
return (
<>
<meta
name="description"
@ -10,20 +16,26 @@ export default {
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:title" content="Documentation - SVR.JS" />
<meta
property="og:title"
content={(frontMatter.title || "Documentation") + " - SVR.JS"}
/>
<meta
property="og:description"
content="The SVR.JS documentation provides comprehensive information and instructions on how to use and configure the SVR.JS web server. This documentation is also a valuable resource for web developers."
/>
<meta property="og:type" content="website" />
<meta property="og:url" content="https://svrjs.org" />
<meta property="og:url" content={url} />
<meta
property="og:image"
content="https://svrjs.vercel.app/metadata/svrjs-cover.png"
/>
<title>Documentation - SVR.JS</title>
<title>{(frontMatter.title || "Documentation") + " - SVR.JS"}</title>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Documentation - SVR.JS" />
<meta
name="twitter:title"
content={(frontMatter.title || "Documentation") + " - SVR.JS"}
/>
<meta
name="twitter:description"
content="The SVR.JS documentation provides comprehensive information and instructions on how to use and configure the SVR.JS web server. This documentation is also a valuable resource for web developers."
@ -33,7 +45,8 @@ export default {
content="https://svrjs.vercel.app/metadata/svrjs-cover.png"
/>
</>
),
);
},
editLink: {
component: null
},