added the option to link older site comments

This commit is contained in:
Rick van Lieshout 2022-09-17 20:26:51 +02:00
parent 35c0956f9b
commit c752310aa0
5 changed files with 8 additions and 4 deletions

View File

@ -9,6 +9,7 @@ tags:
- "Development" - "Development"
- "slsw" - "slsw"
description: "The last day of my journey with Scala is said to be a challenge" description: "The last day of my journey with Scala is said to be a challenge"
disqusId: "24"
--- ---
The book doesn't offer a day 4, my school, however, does. Or rather, it wants us to "create" a day 4. The main objective of day 4 is to "create a [smart](https://en.wikipedia.org/wiki/SMART_criteria) goal which fits the language and challenges you". For this purpose I came up with the following goal: The book doesn't offer a day 4, my school, however, does. Or rather, it wants us to "create" a day 4. The main objective of day 4 is to "create a [smart](https://en.wikipedia.org/wiki/SMART_criteria) goal which fits the language and challenges you". For this purpose I came up with the following goal:

View File

@ -7,9 +7,10 @@ import { useSiteMetadata } from "@/hooks";
interface Props { interface Props {
postTitle: string; postTitle: string;
postSlug: string; postSlug: string;
disqusId?: string;
} }
const Comments: React.FC<Props> = ({ postTitle, postSlug }: Props) => { const Comments: React.FC<Props> = ({ postTitle, postSlug, disqusId }: Props) => {
const { url, disqusShortname } = useSiteMetadata(); const { url, disqusShortname } = useSiteMetadata();
if (!disqusShortname) { if (!disqusShortname) {
@ -21,7 +22,7 @@ const Comments: React.FC<Props> = ({ postTitle, postSlug }: Props) => {
shortname={disqusShortname} shortname={disqusShortname}
config={{ config={{
url: url + postSlug, url: url + postSlug,
identifier: postTitle, identifier: disqusId ?? postTitle,
title: postTitle, title: postTitle,
}} }}
/> />

View File

@ -14,7 +14,7 @@ interface Props {
const Post: React.FC<Props> = ({ post }: Props) => { const Post: React.FC<Props> = ({ post }: Props) => {
const { html } = post; const { html } = post;
const { tagSlugs, slug } = post.fields; const { tagSlugs, slug } = post.fields;
const { tags, title, date } = post.frontmatter; const { tags, title, date, disqusId } = post.frontmatter;
return ( return (
<div className={styles.post}> <div className={styles.post}>
@ -29,7 +29,7 @@ const Post: React.FC<Props> = ({ post }: Props) => {
</div> </div>
<div className={`${styles.comments} hideInPrintView`}> <div className={`${styles.comments} hideInPrintView`}>
<Comments postSlug={slug} postTitle={post.frontmatter.title} /> <Comments disqusId={disqusId} postSlug={slug} postTitle={post.frontmatter.title} />
</div> </div>
</div> </div>
); );

View File

@ -45,6 +45,7 @@ export const query = graphql`
tags tags
title title
socialImage socialImage
disqusId
} }
} }
} }

View File

@ -6,6 +6,7 @@ interface Frontmatter {
description?: string; description?: string;
tags?: Array<string>; tags?: Array<string>;
socialImage?: string; socialImage?: string;
disqusId?: string;
} }
export default Frontmatter; export default Frontmatter;