Skip to content

Commit ccb2fee

Browse files
committed
Facebook Comments -> Disqus
1 parent 0996762 commit ccb2fee

File tree

6 files changed

+8264
-40
lines changed

6 files changed

+8264
-40
lines changed

components/ListItem.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Chip from '@material-ui/core/Chip'
33
import styled from 'styled-components'
44
import { useState, useEffect } from 'react'
55
import Image from 'next/image'
6+
import { CommentCount } from 'disqus-react'
67

78
export default function ListItem({ i }) {
89
const [ isCategories, setIsCategories ] = useState(true)
@@ -44,11 +45,19 @@ export default function ListItem({ i }) {
4445
)}
4546
<div>
4647
<span>
47-
<span
48-
className="fb-comments-count"
49-
data-href={`${process.env.NEXT_PUBLIC_PROD_HOST}/articles/${i.id}`}
50-
></span>
51-
comment(s)
48+
<CommentCount
49+
shortname='youknowwhatblog'
50+
config={
51+
{
52+
url: `${process.env.NEXT_PUBLIC_PROD_HOST}/articles/${i.id.toString()}`,
53+
identifier: i.id.toString(),
54+
title: i.title.toString(),
55+
}
56+
}
57+
>
58+
{/* Placeholder Text */}
59+
Comments
60+
</CommentCount>
5261
</span>
5362
<time dateTime={`${i.published_at.slice(0, 10)}`}>
5463
{new Date(i.published_at).toDateString().slice(4)}

components/article/Comments.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
import styled from 'styled-components'
2-
import { useEffect, useContext } from 'react'
3-
import Context from '../../context'
2+
import { DiscussionEmbed } from 'disqus-react'
43

54
export default function DisqusComments({ params }) {
6-
const { isDarkModeOn } = useContext(Context)
7-
8-
useEffect(() => {
9-
window.FB.XFBML.parse()
10-
})
11-
125
return (
136
<Footer>
14-
<div
15-
className='fb-comments'
16-
data-href={`${process.env.NEXT_PUBLIC_PROD_HOST}/articles/${params.id}`}
17-
data-numposts='10'
18-
data-width='100%'
19-
data-colorscheme={`${isDarkModeOn ? 'dark' : 'light'}`}
20-
data-lazy={true}
21-
></div>
7+
<DiscussionEmbed
8+
shortname='youknowwhatblog'
9+
config={
10+
{
11+
url: `${process.env.NEXT_PUBLIC_PROD_HOST}/articles/${params.id.toString()}`,
12+
identifier: params.id.toString(),
13+
title: params.title.toString(),
14+
language: 'en_GB'
15+
}
16+
}
17+
/>
2218
</Footer>
2319
)
2420
}

0 commit comments

Comments
 (0)