diff --git a/content/posts/2017/scala-day-4-a-challenge.md b/content/posts/2017/scala-day-4-a-challenge.md index d52b18e..bb05908 100644 --- a/content/posts/2017/scala-day-4-a-challenge.md +++ b/content/posts/2017/scala-day-4-a-challenge.md @@ -9,6 +9,7 @@ tags: - "Development" - "slsw" 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: diff --git a/src/components/Post/Comments/Comments.tsx b/src/components/Post/Comments/Comments.tsx index 70bc6fc..843e44b 100644 --- a/src/components/Post/Comments/Comments.tsx +++ b/src/components/Post/Comments/Comments.tsx @@ -7,9 +7,10 @@ import { useSiteMetadata } from "@/hooks"; interface Props { postTitle: string; postSlug: string; + disqusId?: string; } -const Comments: React.FC = ({ postTitle, postSlug }: Props) => { +const Comments: React.FC = ({ postTitle, postSlug, disqusId }: Props) => { const { url, disqusShortname } = useSiteMetadata(); if (!disqusShortname) { @@ -21,7 +22,7 @@ const Comments: React.FC = ({ postTitle, postSlug }: Props) => { shortname={disqusShortname} config={{ url: url + postSlug, - identifier: postTitle, + identifier: disqusId ?? postTitle, title: postTitle, }} /> diff --git a/src/components/Post/Post.tsx b/src/components/Post/Post.tsx index b90666c..7bec907 100644 --- a/src/components/Post/Post.tsx +++ b/src/components/Post/Post.tsx @@ -14,7 +14,7 @@ interface Props { const Post: React.FC = ({ post }: Props) => { const { html } = post; const { tagSlugs, slug } = post.fields; - const { tags, title, date } = post.frontmatter; + const { tags, title, date, disqusId } = post.frontmatter; return (
@@ -29,7 +29,7 @@ const Post: React.FC = ({ post }: Props) => {
- +
); diff --git a/src/templates/PostTemplate/PostTemplate.tsx b/src/templates/PostTemplate/PostTemplate.tsx index d868a38..a99f780 100644 --- a/src/templates/PostTemplate/PostTemplate.tsx +++ b/src/templates/PostTemplate/PostTemplate.tsx @@ -45,6 +45,7 @@ export const query = graphql` tags title socialImage + disqusId } } } diff --git a/src/types/frontmatter.ts b/src/types/frontmatter.ts index 8b6638e..beca5c9 100644 --- a/src/types/frontmatter.ts +++ b/src/types/frontmatter.ts @@ -6,6 +6,7 @@ interface Frontmatter { description?: string; tags?: Array; socialImage?: string; + disqusId?: string; } export default Frontmatter;