mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
added the option to link older site comments
This commit is contained in:
@@ -7,9 +7,10 @@ import { useSiteMetadata } from "@/hooks";
|
||||
interface Props {
|
||||
postTitle: 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();
|
||||
|
||||
if (!disqusShortname) {
|
||||
@@ -21,7 +22,7 @@ const Comments: React.FC<Props> = ({ postTitle, postSlug }: Props) => {
|
||||
shortname={disqusShortname}
|
||||
config={{
|
||||
url: url + postSlug,
|
||||
identifier: postTitle,
|
||||
identifier: disqusId ?? postTitle,
|
||||
title: postTitle,
|
||||
}}
|
||||
/>
|
||||
|
@@ -14,7 +14,7 @@ interface Props {
|
||||
const Post: React.FC<Props> = ({ post }: Props) => {
|
||||
const { html } = post;
|
||||
const { tagSlugs, slug } = post.fields;
|
||||
const { tags, title, date } = post.frontmatter;
|
||||
const { tags, title, date, disqusId } = post.frontmatter;
|
||||
|
||||
return (
|
||||
<div className={styles.post}>
|
||||
@@ -29,7 +29,7 @@ const Post: React.FC<Props> = ({ post }: Props) => {
|
||||
</div>
|
||||
|
||||
<div className={`${styles.comments} hideInPrintView`}>
|
||||
<Comments postSlug={slug} postTitle={post.frontmatter.title} />
|
||||
<Comments disqusId={disqusId} postSlug={slug} postTitle={post.frontmatter.title} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@@ -45,6 +45,7 @@ export const query = graphql`
|
||||
tags
|
||||
title
|
||||
socialImage
|
||||
disqusId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ interface Frontmatter {
|
||||
description?: string;
|
||||
tags?: Array<string>;
|
||||
socialImage?: string;
|
||||
disqusId?: string;
|
||||
}
|
||||
|
||||
export default Frontmatter;
|
||||
|
Reference in New Issue
Block a user