|
| 1 | +import { useRouter } from "next/router"; |
| 2 | +import { useConfig } from "nextra-theme-docs"; |
| 3 | + |
| 4 | +export const HeadComponent = () => { |
| 5 | + const { asPath, defaultLocale, locale } = useRouter(); |
| 6 | + const { frontMatter } = useConfig(); |
| 7 | + |
| 8 | + const url = |
| 9 | + "https://memgraph.com/docs" + |
| 10 | + (defaultLocale === locale ? asPath : `/${locale}${asPath}`); |
| 11 | + const description = |
| 12 | + frontMatter.description || |
| 13 | + "Discover the comprehensive Memgraph documentation and learn how to use the powerful graph database to its full potential."; |
| 14 | + const imageUrl = |
| 15 | + frontMatter.image || |
| 16 | + "https://memgraph.com/docs/memgraph-docs-ogimage-small.png"; |
| 17 | + |
| 18 | + return ( |
| 19 | + <> |
| 20 | + {/* Basic Metadata */} |
| 21 | + <title>{frontMatter.title || "Memgraph documentation"}</title> |
| 22 | + <meta name="description" content={description} /> |
| 23 | + <link rel="icon" href="/docs/favicon.png" type="image/png" /> |
| 24 | + <link rel="canonical" href={url} /> |
| 25 | + |
| 26 | + {/* Open Graph Meta Tags */} |
| 27 | + <meta property="og:type" content="website" /> |
| 28 | + <meta property="og:url" content={url} /> |
| 29 | + <meta property="og:title" content={frontMatter.title || "Memgraph documentation"} /> |
| 30 | + <meta property="og:description" content={description} /> |
| 31 | + <meta property="og:image" content={imageUrl} /> |
| 32 | + <meta property="og:image:width" content="600" /> |
| 33 | + <meta property="og:image:height" content="314" /> |
| 34 | + <meta property="og:site_name" content="Memgraph documentation" /> |
| 35 | + |
| 36 | + {/* Twitter Meta Tags */} |
| 37 | + <meta property="twitter:card" content="summary_large_image" /> |
| 38 | + <meta property="twitter:title" content={frontMatter.title || "Memgraph documentation"} /> |
| 39 | + <meta property="twitter:description" content={description} /> |
| 40 | + <meta property="twitter:image" content={imageUrl} /> |
| 41 | + <meta property="twitter:site" content="@memgraphdb" /> |
| 42 | + <meta property="twitter:creator" content="@memgraphdb" /> |
| 43 | + </> |
| 44 | + ); |
| 45 | +}; |
0 commit comments