feat: add meta for each page in theme.config.tsx

This commit is contained in:
Anthony Berg 2023-06-24 02:08:03 +01:00
parent 1acd4133f1
commit 8e0b0c3c03

View File

@ -1,3 +1,6 @@
import { useRouter } from 'next/router';
import { useConfig } from 'nextra-theme-docs';
export default {
project: {
link: 'https://github.com/smyalygames/flightsim-on-linux',
@ -9,6 +12,22 @@ export default {
titleTemplate: '%s - Flight Sim on Linux'
}
},
head: () => {
const { asPath, defaultLocale, locale } = useRouter();
const { frontMatter } = useConfig();
const url = 'https://www.flightsimonlinux.com' + (defaultLocale === locale ? asPath : `/${locale}${asPath}`);
return (
<>
<meta property="og:url" content={url} />
<meta property="og:title" content={frontMatter.title || 'Flight Sim on Linux'} />
<meta
property="og:description"
content={frontMatter.description || 'Guides to running Flight Simulators on Linux'}
/>
</>
)
},
footer: {
text: (
<span>