diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-03-30 19:37:24 +0200 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-03-30 19:37:24 +0200 |
commit | 71ab18ec4264197aae27efe64e4565c4989a19cd (patch) | |
tree | 561f82b426e0fca092b22e1f10e1a507091925e7 /pages/post | |
parent | 609c78e15c43ae0a3733640c724e2f3b1a08ab80 (diff) |
scripts + links
Diffstat (limited to 'pages/post')
-rw-r--r-- | pages/post/[id].tsx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx index 23ce14e..8f6dde8 100644 --- a/pages/post/[id].tsx +++ b/pages/post/[id].tsx @@ -17,6 +17,7 @@ export interface ArticleMeta { tags?: Array<string>; date?: string; chapters?: Array<chapter>; + id?: string; } export function RenderedArticle(props: { content: string }) { @@ -104,7 +105,7 @@ function parseToCRecursive(headings: Array<string>): Array<chapter> { var chapterName = headings[i].match(/^[#]+\s+(.+)/)[1]; children.push({ name: chapterName, - sectionLink: sectionID(chapterName), + sectionLink: "#" + sectionID(chapterName), unparsedChildren: [], }); currentChildIndex += 1; @@ -141,6 +142,7 @@ export function getStaticProps(props: {params: { id: string }}) { var filecontent = readFileSync(filename).toString().trim() var parsed = preprocessor(filecontent); + parsed.meta.id = props.params.id; return { props: { |