Skip to content

Commit 458ce98

Browse files
committed
refactor(website): remove unused '_document.tsx' and update head configuration in 'theme.config.tsx'
1 parent 2b8ca32 commit 458ce98

File tree

3 files changed

+39
-61
lines changed

3 files changed

+39
-61
lines changed

website/pages/_document.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

website/pages/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: Home
3+
---
4+
15
import { Logo } from "#/components/logo";
26
import { TweetCards } from "#/widgets/tweet-cards";
37

website/theme.config.tsx

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { DocsThemeConfig } from "nextra-theme-docs";
1+
import { useConfig, type DocsThemeConfig } from "nextra-theme-docs";
22

33
import logo from "#/assets/logo.svg";
44
import { Image } from "#/components/image";
@@ -19,41 +19,40 @@ export default {
1919
sidebar: {
2020
defaultMenuCollapseLevel: 1,
2121
},
22-
// useNextSeoProps() {
23-
// return match(useRouter())
24-
// .with({ asPath: "/" }, () => ({
25-
// title: "ESLint React",
26-
// description:
27-
// "ESLint React - A series of composable ESLint plugins for libraries and frameworks that use React as a UI runtime.",
28-
// }))
29-
// .with({ asPath: P.string.startsWith("/rules/") }, () => ({
30-
// titleTemplate: "Rule: %s",
31-
// }))
32-
// .otherwise(() => ({
33-
// titleTemplate: "%s – ESLint React",
34-
// }));
35-
// },
36-
head: (
37-
<>
38-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
39-
<meta property="og:title" content="ESLint React" />
40-
<meta
41-
property="og:description"
42-
content="ESLint React - The most advancedlinting rules for React."
43-
/>
44-
<link
45-
rel="apple-touch-icon"
46-
sizes="180x180"
47-
href={`${PUBLIC_URL}/apple-touch-icon.png`}
48-
/>
49-
<link
50-
rel="icon"
51-
type="image/png"
52-
href={`${PUBLIC_URL}/favicon.png`}
53-
/>
54-
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
55-
</>
56-
),
22+
head: function useHead() {
23+
const config = useConfig();
24+
const title = `${config.title} – ESLint React`;
25+
const description = config.frontMatter["description"]
26+
|| "ESLint React - The most advanced linting rules for React.";
27+
const image = config.frontMatter["image"]
28+
|| `${PUBLIC_URL}/og.png`;
29+
return (
30+
<>
31+
<title>{title}</title>
32+
<meta property="og:title" content={title} />
33+
<meta name="description" content={description} />
34+
<meta property="og:description" content={description} />
35+
<meta name="og:image" content={image} />
36+
<meta name="msapplication-TileColor" content="#fff" />
37+
<meta httpEquiv="Content-Language" content="en" />
38+
<meta name="apple-mobile-web-app-title" content="Nextra" />
39+
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png" />
40+
41+
<meta name="twitter:card" content="summary_large_image" />
42+
<meta name="twitter:site" content="https://nextra.site" />
43+
<link
44+
rel="apple-touch-icon"
45+
sizes="180x180"
46+
href={`${PUBLIC_URL}/apple-touch-icon.png`}
47+
/>
48+
<link
49+
rel="icon"
50+
type="image/png"
51+
href={`${PUBLIC_URL}/favicon.png`}
52+
/>
53+
</>
54+
);
55+
},
5756
logo: (
5857
<div className="w-24">
5958
<Image src={logo} width="48" height="48" alt="eslint-react" />

0 commit comments

Comments
 (0)