Skip to content

Commit

Permalink
feat(docs): add canonical links (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed May 31, 2024
1 parent 96f0c3a commit 55f5654
Show file tree
Hide file tree
Showing 26 changed files with 3,308 additions and 131 deletions.
2 changes: 2 additions & 0 deletions .changeset/proud-rocks-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const blogFrontMatter: IPageMeta = {
publishDate: '2018-02-07T00:00:00.000Z',
layout: 'full',
order: 6,
canonicalURL:
'https://docs.kadena.io/blogchain/2018/the-evm-is-fundamentally-unsafe-2018-02-07',
};

export const fullLayoutFrontMatter: IPageMeta = {
Expand All @@ -47,6 +49,7 @@ export const fullLayoutFrontMatter: IPageMeta = {
label: 'Overview',
order: 1,
layout: 'full',
canonicalURL: 'https://docs.kadena.io/kadena/overview',
};

export const landingFrontMatter: IBasePageMeta = {
Expand Down Expand Up @@ -78,4 +81,5 @@ export const redoclyFrontMatter: IPageMeta = {
title: 'What is KDA?',
},
},
canonicalURL: 'https://docs.kadena.io/kadena/overview',
};
3 changes: 2 additions & 1 deletion packages/apps/docs/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const MyApp = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [router.isReady]);

const { title, description, headerImage } = props.frontmatter;
const { title, description, headerImage, canonicalURL } = props.frontmatter;
const defaultImagePath = '/assets/og_banner.jpeg';
const ogImage = headerImage
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}${headerImage}`
Expand All @@ -66,6 +66,7 @@ export const MyApp = ({
<>
<Head>
<title>{`${title} | Kadena Docs`}</title>
{canonicalURL && <link rel="canonical" href={canonicalURL} />}
<link rel="manifest" href="/manifest.json" />
<meta name="title" content={`${title} | Kadena Docs`} />
<meta name="description" content={description} />
Expand Down
1 change: 1 addition & 0 deletions packages/tools/docs-tools/src/mock/config.mock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pages:
build:
url: /build
file: /index.tsx
repo: https://github.com/kadena-community/kadena.js
build2:
url: /build2
file: /test.md
Expand Down
13 changes: 13 additions & 0 deletions packages/tools/docs-tools/src/mock/getData.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { readFile } from 'fs/promises';
import { join } from 'path';
import type { IMenuData } from './../types';

const getData = async (): Promise<IMenuData[]> => {
const configFilePath = join(process.cwd(), 'src/mock/menu.mock.json');
const result = await readFile(configFilePath, 'utf-8');

const data = JSON.parse(result);
return data as IMenuData[];
};

export { getData };
2 changes: 1 addition & 1 deletion packages/tools/docs-tools/src/mock/loadConfigPages.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { IConfig, IConfigTreeItem } from 'src/types';

export const loadConfigPages = (): IConfigTreeItem[] => {
const data = fs.readFileSync(
`${process.cwd()}/src/scripts/fixLocalLinks/utils/__tests__/config.mock.yaml`,
`${process.cwd()}/src/mock/config.mock.yaml`,
'utf-8',
);
const { pages } = yaml.load(data) as IConfig;
Expand Down
Loading

0 comments on commit 55f5654

Please sign in to comment.