Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 594e0ce

Browse files
committed
updates
1 parent e72d328 commit 594e0ce

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

gatsby-node-docs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
2222
return;
2323
}
2424

25-
result.data.allMarkdownRemark.edges.forEach(() => {
25+
result.data.allMarkdownRemark.edges.forEach(node => {
2626
createPage({
27-
// path: node.frontmatter.slug,
28-
path: 'test',
27+
path: node.frontmatter.slug,
28+
// path: 'test',
2929
component: docsTemplate,
3030
});
3131
});

src/pages/docs-demo.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { graphql } from 'gatsby';
22
import React from 'react';
3+
import Article from '../components/Article';
34
import Layout from '../components/Layout';
45

56
const title = 'Download Node.js';
@@ -13,19 +14,22 @@ interface Props {
1314
};
1415
}
1516

16-
const DocsLayout = ({ data }: Props): React.ReactNode => (
17-
<Layout title={title} description={description}>
18-
<main>
19-
{console.log(data)}
20-
<p
21-
style={{ width: '100%' }}
22-
dangerouslySetInnerHTML={{
23-
__html:data.doc.edges[102].node.html,
24-
}}
25-
/>
26-
</main>
27-
</Layout>
28-
);
17+
const DocsLayout = ({ data }: Props): JSX.Element => {
18+
const authors = [''];
19+
return (
20+
<Layout title={title} description={description}>
21+
<main className="docs-container">
22+
<Article
23+
title=""
24+
html={data.doc.edges[105].node.html}
25+
authors={authors}
26+
editPath="node_modules/node-i18n/content/v12.x/en-US/doc/"
27+
/>
28+
{console.log(data)}
29+
</main>
30+
</Layout>
31+
);
32+
};
2933
export default DocsLayout;
3034

3135
export const query = graphql`
@@ -38,6 +42,7 @@ export const query = graphql`
3842
title
3943
}
4044
html
45+
tableOfContents(absolute: true, pathToSlugField: "frontmatter.path")
4146
}
4247
}
4348
}

src/styles/layout.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ details {
521521
}
522522
}
523523

524-
.blog-container {
524+
.blog-container,
525+
.docs-container {
525526
display: flex;
526527
justify-content: center;
527528
}

0 commit comments

Comments
 (0)