Skip to content

Commit 3fcef24

Browse files
committed
Add SEO (including better tab titles)
1 parent d9fba6c commit 3fcef24

24 files changed

+148
-42
lines changed

web/components/markdown.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {Col} from "web/components/layout/col";
33
import ReactMarkdown from "react-markdown";
44
import React from "react";
55
import Link from "next/link";
6+
import {SEO} from "web/components/SEO";
7+
import {capitalize} from "lodash";
68

79
type Props = {
810
content: string;
@@ -26,8 +28,14 @@ const MarkdownLink = ({href, children}: { href?: string; children: React.ReactNo
2628
}
2729

2830
export default function MarkdownPage({content, filename}: Props) {
31+
const title = /[A-Z]/.test(filename) ? filename : capitalize(filename)
2932
return (
3033
<PageBase trackPageView={filename} className={'col-span-8'}>
34+
<SEO
35+
title={title}
36+
description={title}
37+
url={`/` + filename}
38+
/>
3139
<Col className="items-center">
3240
<Col className='w-full rounded px-3 py-4 sm:px-6 space-y-4 custom-link'>
3341
<ReactMarkdown

web/pages/404.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ import { Col } from 'web/components/layout/col'
66
import { Title } from 'web/components/widgets/title'
77
import { ExternalLinkIcon } from '@heroicons/react/outline'
88
import {discordLink, formLink, githubIssues} from "common/constants";
9+
import {SEO} from "web/components/SEO";
10+
import React from "react";
911

1012
export default function Custom404(props: { customText?: string }) {
1113
return (
1214
<PageBase trackPageView={'404'}>
15+
<SEO
16+
title={'Not Found'}
17+
description={'Not Found'}
18+
url={`/404`}
19+
/>
1320
<Custom404Content customText={props.customText} />
1421
</PageBase>
1522
)

web/pages/about.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {PageBase} from 'web/components/page-base'
2-
import {ReactNode} from "react";
2+
import React, {ReactNode} from "react";
33
import Link from "next/link";
44
import {discordLink, formLink, githubRepo} from "common/constants";
5+
import {SEO} from "web/components/SEO";
56

67

78
export const AboutBlock = (props: {
@@ -18,6 +19,11 @@ export const AboutBlock = (props: {
1819
export default function About() {
1920
return (
2021
<PageBase trackPageView={'about'}>
22+
<SEO
23+
title={'About'}
24+
description={'About Compass'}
25+
url={`/about`}
26+
/>
2127
<div className="text-gray-600 dark:text-white min-h-screen p-6">
2228
<div className="w-full">
2329
<div className="relative py-8 mb-8 overflow-hidden">

web/pages/confirm-email/[tokenId].tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import {PageBase} from 'web/components/page-base'
22
import {Col} from 'web/components/layout/col'
3+
import {SEO} from "web/components/SEO";
4+
import React from "react";
35

46
export default function ConfirmEmail() {
57
return (
68
<PageBase trackPageView={'private messages page'}>
9+
<SEO
10+
title={'Confirm Email'}
11+
description={'Confirm your email'}
12+
url={`/confirm-email`}
13+
/>
714
<Col className="items-center justify-center h-full">
815
<div className="text-xl font-semibold text-center mt-8">
916
Thank you for confirming your email!

web/pages/constitution.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const FILENAME = __filename.split('/').pop()?.split('.').shift();
88
export async function getStaticProps() {
99
const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md');
1010
const content = fs.readFileSync(filePath, 'utf8');
11-
return {props: {content}};
11+
return {props: {content, filename: FILENAME}};
1212
}
1313

14-
type Props = { content: string };
14+
type Props = { content: string, filename: string };
1515

16-
export default function Faq({content}: Props) {
17-
if (!FILENAME) throw new Error('Could not determine filename');
18-
return <MarkdownPage content={content} filename={FILENAME}></MarkdownPage>
16+
export default function Page({content, filename}: Props) {
17+
if (!filename) throw new Error('Could not determine filename');
18+
return <MarkdownPage content={content} filename={filename}></MarkdownPage>
1919
}

web/pages/contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {ContactComponent} from "web/components/contact";
66
export default function ContactPage() {
77
return (
88
<PageBase
9-
trackPageView={'vote page'}
9+
trackPageView={'contact page'}
1010
className={'relative p-2 sm:pt-0'}
1111
>
1212
<SEO

web/pages/faq.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ const FILENAME = __filename.split('/').pop()?.split('.').shift();
77
export async function getStaticProps() {
88
const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md');
99
const content = fs.readFileSync(filePath, 'utf8');
10-
return {props: {content}};
10+
return {props: {content, filename: FILENAME}};
1111
}
1212

13-
type Props = { content: string };
13+
type Props = { content: string, filename: string };
1414

15-
export default function Faq({content}: Props) {
16-
if (!FILENAME) throw new Error('Could not determine filename');
17-
return <MarkdownPage content={content} filename={FILENAME}></MarkdownPage>
18-
}
15+
export default function Page({content, filename}: Props) {
16+
if (!filename) throw new Error('Could not determine filename');
17+
return <MarkdownPage content={content} filename={filename.toUpperCase()}></MarkdownPage>
18+
}

web/pages/financials.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const FILENAME = __filename.split('/').pop()?.split('.').shift();
88
export async function getStaticProps() {
99
const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md');
1010
const content = fs.readFileSync(filePath, 'utf8');
11-
return {props: {content}};
11+
return {props: {content, filename: FILENAME}};
1212
}
1313

14-
type Props = { content: string };
14+
type Props = { content: string, filename: string };
1515

16-
export default function Faq({content}: Props) {
17-
if (!FILENAME) throw new Error('Could not determine filename');
18-
return <MarkdownPage content={content} filename={FILENAME}></MarkdownPage>
16+
export default function Page({content, filename}: Props) {
17+
if (!filename) throw new Error('Could not determine filename');
18+
return <MarkdownPage content={content} filename={filename}></MarkdownPage>
1919
}

web/pages/help.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import {SEO} from 'web/components/SEO'
33
import Link from 'next/link'
44
import {Col} from 'web/components/layout/col'
55
import {Row} from 'web/components/layout/row'
6+
import React from "react";
67

78
export default function HelpPage() {
89
return (
910
<PageBase trackPageView={'help'} className={'relative p-2 sm:pt-0'}>
11+
<SEO
12+
title={'Help'}
13+
description={'Help and support for Compass'}
14+
url={`/help`}
15+
/>
1016
<SEO title={`Help`} description={'Get help with Compass'} url={`/help`}/>
1117
<Col className="max-w-3xl w-full mx-auto gap-6 custom-link">
1218
<h1 className="text-3xl font-semibold">Help & Support</h1>

web/pages/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Col} from 'web/components/layout/col'
33
import {useUser} from 'web/hooks/use-user'
44
import {LoggedOutHome} from "web/components/home/home";
55
import {ProfilesHome} from "web/components/profiles/profiles-home";
6+
import React from "react";
67

78

89
export default function ProfilesPage() {

0 commit comments

Comments
 (0)