|
1 | 1 | import React from "react"; |
2 | | -import { DocsThemeConfig } from "nextra-theme-docs"; |
| 2 | +import { DocsThemeConfig, useConfig } from "nextra-theme-docs"; |
| 3 | +import { useRouter } from "next/router"; |
3 | 4 |
|
4 | 5 | const config: DocsThemeConfig = { |
5 | | - logo: <span>My Project</span>, |
| 6 | + head: () => { |
| 7 | + const { asPath } = useRouter(); |
| 8 | + const { frontMatter, title } = useConfig(); |
| 9 | + const defaultDescription = "Documentation for VZN Scripts assets"; |
| 10 | + const url = `https://docs.vzn-scripts.com/${asPath}`; |
| 11 | + |
| 12 | + return ( |
| 13 | + <> |
| 14 | + <link rel="icon" type="image/png" href="/logo.png" /> |
| 15 | + |
| 16 | + <meta httpEquiv="Content-Language" content="en" /> |
| 17 | + <meta |
| 18 | + name="description" |
| 19 | + content={frontMatter.description || defaultDescription} |
| 20 | + /> |
| 21 | + <meta |
| 22 | + name="og:title" |
| 23 | + content={title || "VZN Scripts Documentation"} |
| 24 | + /> |
| 25 | + <meta name="og:url" content={url} /> |
| 26 | + <meta |
| 27 | + name="og:description" |
| 28 | + content={frontMatter.description || defaultDescription} |
| 29 | + /> |
| 30 | + <meta |
| 31 | + name="viewport" |
| 32 | + content="width=device-width, initial-scale=1.0" |
| 33 | + /> |
| 34 | + </> |
| 35 | + ); |
| 36 | + }, |
| 37 | + logo: ( |
| 38 | + <div |
| 39 | + style={{ |
| 40 | + display: "flex", |
| 41 | + alignItems: "center", |
| 42 | + gap: "5px", |
| 43 | + }} |
| 44 | + > |
| 45 | + <div |
| 46 | + style={{ |
| 47 | + width: "38px", |
| 48 | + height: "38px", |
| 49 | + background: |
| 50 | + "url('https://avatars.githubusercontent.com/u/175264237?s=38') no-repeat left", |
| 51 | + backgroundSize: "38px", |
| 52 | + borderRadius: "50%", |
| 53 | + }} |
| 54 | + ></div> |
| 55 | + <span |
| 56 | + style={{ |
| 57 | + fontWeight: 550, |
| 58 | + lineHeight: "38px", |
| 59 | + }} |
| 60 | + ></span> |
| 61 | + VZN Scripts |
| 62 | + </div> |
| 63 | + ), |
| 64 | + useNextSeoProps: () => { |
| 65 | + // credits for overextended for this function |
| 66 | + const { asPath } = useRouter(); |
| 67 | + const arr = asPath.replace(/[-_]/g, " ").split("/"); |
| 68 | + const category = (arr[1][0] !== "#" && arr[1]) || "VZN Scripts"; |
| 69 | + const rawTitle = arr[arr.length - 1]; |
| 70 | + const title = |
| 71 | + /[a-z]/.test(rawTitle) && /[A-Z]/.test(rawTitle) ? rawTitle : "%s"; |
| 72 | + |
| 73 | + return { |
| 74 | + titleTemplate: `${title} | ${ |
| 75 | + rawTitle === category |
| 76 | + ? "Documentation" |
| 77 | + : category.replace(/(^\w|\s\w)/g, (m) => m.toUpperCase()) |
| 78 | + }`, |
| 79 | + }; |
| 80 | + }, |
6 | 81 | project: { |
7 | | - link: "https://github.com/VZN-Scripts/docs", |
| 82 | + link: "https://github.com/VZN-Scripts", |
8 | 83 | }, |
9 | 84 | chat: { |
10 | 85 | link: "https://discord.gg/wqzrVM3QYk", |
11 | 86 | }, |
12 | | - docsRepositoryBase: "https://github.com/VZN-Scripts/docs/blob/main", |
| 87 | + docsRepositoryBase: |
| 88 | + "https://github.com/VZN-Scripts/vzn-scripts.github.io/blob/main", |
13 | 89 | footer: { |
14 | 90 | text: "VZN Scripts", |
15 | 91 | }, |
|
0 commit comments