Skip to content

Commit 6996d5a

Browse files
committed
Merge branch 'cloudflare' of github.com:FrontMatter/web-documentation-nextjs into cloudflare
2 parents f8af304 + b2e6590 commit 6996d5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+907
-1449
lines changed

.frontmatter/database/mediaDb.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

components/Docs/PageActions.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { PencilIcon } from '@heroicons/react/24/outline';
22
import * as React from 'react';
33
import { Extension } from '../../constants/extension';
44
import { PageFrontMatter } from '../../models/PageFrontMatter';
5+
import { CONFIG } from '../../constants';
56

67
export interface IPageActionsProps {
78
page: PageFrontMatter | undefined;
@@ -16,7 +17,7 @@ export const PageActions: React.FunctionComponent<IPageActionsProps> = ({ page }
1617
<div className={`mt-16 mb-8`}>
1718
<a
1819
className={`flex items-center text-whisper-900 hover:text-whisper-500`}
19-
href={`${Extension.githubDocs}/edit/${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`}
20+
href={`${Extension.githubDocs}/edit/${CONFIG.environment === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`}
2021
target="_blank"
2122
rel={`noopener noreferrer`}>
2223
<PencilIcon className={`w-4 h-4 mr-2`} /> <span>Edit page</span>

components/Docs/PageInfo.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Extension } from '../../constants/extension';
55
import { PageFrontMatter } from '../../models/PageFrontMatter';
66
import Giscus from "@giscus/react";
77
import { PageActions } from './PageActions';
8+
import { CONFIG } from '../../constants';
89

910
export interface IPageInfoProps {
1011
items: PageFrontMatter[];
@@ -36,7 +37,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
3637
}
3738

3839
const date = parseJSON(page.lastmod);
39-
// const feedbackUrl = `${Extension.issueLink}/new?title=Feedback:%20&body=%0A%0A%5BEnter%20feedback%20here%5D%0A%0A%0A---%0A%23%23%23%23%20Document%20Details%0A%0A%E2%9A%A0%20*Do%20not%20edit%20this%20section*%0A%0A*%20ID%3A%20${page.fileName}%0A*%20URL%3A%20${`${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? Extension.mainSite : Extension.betaSite}/docs/${page.fileName}`}%0A*%20Content%20Source%3A%20${encodeURIComponent(`/content/docs/${page.fileName}.md`)}`;
40+
// const feedbackUrl = `${Extension.issueLink}/new?title=Feedback:%20&body=%0A%0A%5BEnter%20feedback%20here%5D%0A%0A%0A---%0A%23%23%23%23%20Document%20Details%0A%0A%E2%9A%A0%20*Do%20not%20edit%20this%20section*%0A%0A*%20ID%3A%20${page.fileName}%0A*%20URL%3A%20${`${CONFIG.environment === "production" ? Extension.mainSite : Extension.betaSite}/docs/${page.fileName}`}%0A*%20Content%20Source%3A%20${encodeURIComponent(`/content/docs/${page.fileName}.md`)}`;
4041

4142
return (
4243
<>
@@ -88,7 +89,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
8889
reactionsEnabled="0"
8990
emitMetadata="0"
9091
inputPosition="top"
91-
theme={process.env.NEXT_PUBLIC_GISCUS_THEME}
92+
theme={CONFIG.giscus.theme}
9293
lang="en"
9394
loading="lazy" />
9495
</div>
@@ -102,7 +103,7 @@ export const PageInfo: React.FunctionComponent<IPageInfoProps> = ({ page, items
102103
}
103104

104105
<div className="mt-2 text-sm">
105-
<p>Did you spot an issue in our documentation, or want to contribute? Edit this page on <a className={`text-teal-500 hover:text-teal-900`} href={`${Extension.githubDocs}/edit/${process.env.NEXT_PUBLIC_VERCEL_ENV === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`} target="_blank" rel={`noopener noreferrer`}>Github</a>!</p>
106+
<p>Did you spot an issue in our documentation, or want to contribute? Edit this page on <a className={`text-teal-500 hover:text-teal-900`} href={`${Extension.githubDocs}/edit/${CONFIG.environment === "production" ? "main" : "dev"}/content/docs/${page.fileName}.md`} target="_blank" rel={`noopener noreferrer`}>Github</a>!</p>
106107
</div>
107108
</div>
108109
</>

components/Page/DocsLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Header } from './Header';
99
import { Home } from './Home';
1010
import { Sponsors } from './Sponsors';
1111
import { AiOutlineRobot } from 'react-icons/ai';
12+
import { CONFIG } from '../../constants';
1213

1314
export interface IDocsLayoutProps {
1415
navItems?: PageFrontMatter[];
@@ -69,7 +70,7 @@ export const DocsLayout: React.FunctionComponent<React.PropsWithChildren<IDocsLa
6970
backgroundColor: "transparent",
7071
color: "transparent"
7172
}}
72-
anon_key={process.env.MENDABLE_ANON_KEY ?? ""} />
73+
anon_key={CONFIG.mendable.key ?? ""} />
7374
</div>
7475

7576
<Footer />

components/Page/Searchbox.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ import * as React from 'react';
22
// const docsearch = require('@docsearch/js');
33
// import { useEffect } from 'react';
44
import { DocSearch } from '@docsearch/react';
5+
import { CONFIG } from '../../constants';
56

6-
export interface ISearchboxProps {}
7+
export interface ISearchboxProps { }
78

89
export const Searchbox: React.FunctionComponent<ISearchboxProps> = (props: React.PropsWithChildren<ISearchboxProps>) => {
910

1011
return (
1112
<>
12-
<DocSearch
13-
apiKey={process.env.NEXT_PUBLIC_AGOLIA_APIKEY || ""}
14-
indexName={process.env.NEXT_PUBLIC_AGOLIA_INDEX || ""}
15-
appId={process.env.NEXT_PUBLIC_AGOLIA_APPID || ""}
13+
<DocSearch
14+
apiKey={CONFIG.agolia.apiKey || ""}
15+
indexName={CONFIG.agolia.index || ""}
16+
appId={CONFIG.agolia.appId || ""}
1617
disableUserPersonalization={true}
17-
/>
18+
/>
1819
</>
1920
);
2021
};

components/Page/Sponsors.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { Sponsor, SponsorData } from '../../models/SponsorData';
66
import sponsors from '../../sponsors.json';
7+
import { CONFIG } from '../../constants';
78

89
export interface ISponsorsProps { }
910

@@ -13,7 +14,7 @@ export const Sponsors: React.FunctionComponent<ISponsorsProps> = (props: React.P
1314

1415
useEffect(() => {
1516
const getSponsors = async () => {
16-
const response = await fetch('/api/sponsors');
17+
const response = await fetch(`${CONFIG.urls.api}/api/sponsors`);
1718

1819
if (!response.ok) {
1920
setIndividuals(null);

constants/config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const CONFIG = {
2+
urls: {
3+
api: process.env.NEXT_PUBLIC_API_URL,
4+
production: "https://frontmatter.codes",
5+
preview: "https://cloudflare.front-matter-docs.pages.dev",
6+
local: "http://localhost:3000",
7+
},
8+
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
9+
github: {
10+
token: process.env.GITHUB_AUTH,
11+
},
12+
sponsors: process.env.BACKERS,
13+
agolia: {
14+
apiKey: process.env.NEXT_PUBLIC_AGOLIA_APIKEY,
15+
index: process.env.NEXT_PUBLIC_AGOLIA_INDEX,
16+
appId: process.env.NEXT_PUBLIC_AGOLIA_APPID,
17+
},
18+
giscus: {
19+
theme: process.env.NEXT_PUBLIC_GISCUS_THEME,
20+
},
21+
mendable: {
22+
key: process.env.MENDABLE_ANON_KEY,
23+
},
24+
};

constants/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from "./config";
2+
export * from "./extension";
3+
export * from "./features";
4+
export * from "./navigation";

content/docs/dashboard/content-view.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Content view
33
slug: dashboard/content-view
44
description: null
55
date: 2022-11-28T14:55:04.221Z
6-
lastmod: 2024-02-22T12:24:21.051Z
6+
lastmod: 2024-06-20T08:31:20.651Z
77
weight: 300.1
88
---
99

@@ -12,6 +12,14 @@ weight: 300.1
1212
The contents view is the default view when you open the dashboard. It will show you all the pages in
1313
your project, and allow you to filter and sort them.
1414

15+
<!-- FM:Snippet:Start data:{"id":"Open in VS Code","fields":[{"name":"title","value":"Open dashboard in VS Code"},{"name":"command","value":"frontMatter.dashboard"},{"name":"title","value":"Open dashboard in VS Code"}]} -->
16+
<a class="open_vscode" title="Open content dashboard in VS Code" href='vscode://eliostruyf.execcommand?command=frontMatter.dashboard'>
17+
Open content dashboard in VS Code
18+
</a>
19+
<!-- FM:Snippet:End -->
20+
21+
![Dashboard - Contents view][07]
22+
1523
## Card configuration
1624

1725
### Card field configuration
@@ -169,3 +177,4 @@ of the content view. This will allow you to quickly access.
169177
[03]: /docs/content-creation/fields#draft
170178
[04]: /releases/v5.3.0/draft-status.png
171179
[06]: /docs/experimental/ui-extensibility#registering-a-custom-ui-extension
180+
[07]: /releases/v7.1.0/dashboard-7.1.0.png

content/docs/dashboard/datafiles-view.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: Data files view
33
slug: dashboard/datafiles-view
44
description: null
55
date: 2022-11-28T14:55:04.221Z
6-
lastmod: 2024-02-22T12:23:03.653Z
7-
weight: 300.3
6+
lastmod: 2024-06-20T08:29:08.737Z
7+
weight: 300.4
88
---
99

1010
# Data files view
@@ -13,10 +13,21 @@ Data files/folders are pieces of content that do not belong to any markdown cont
1313
their own. Most of the time, these data files are used to store additional information about your
1414
project/blog/website that will be used to render the content.
1515

16-
For example: navigation, social media links, contacts, etc.
16+
For example:
17+
18+
- navigation
19+
- social media links
20+
- contacts
21+
- etc.
1722

1823
The data files dashboard allows you to quickly manage your data files.
1924

25+
<!-- FM:Snippet:Start data:{"id":"Open in VS Code","fields":[{"name":"title","value":"Open data dashboard in VS Code"},{"name":"command","value":"frontMatter.dashboard.data"},{"name":"title","value":"Open data dashboard in VS Code"}]} -->
26+
<a class="open_vscode" title="Open data dashboard in VS Code" href='vscode://eliostruyf.execcommand?command=frontMatter.dashboard.data'>
27+
Open data dashboard in VS Code
28+
</a>
29+
<!-- FM:Snippet:End -->
30+
2031
![Data files dashboard][01]
2132

2233
## Configuration

0 commit comments

Comments
 (0)