File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -120,13 +120,15 @@ jobs:
120
120
SITE_GA_ID : ${{ vars.SITE_GA_ID }}
121
121
SITE_SWETRIX_ID : ${{ vars.SITE_SWETRIX_ID }}
122
122
SITE_COUNTER_ANALYTICS_ID : ${{ vars.SITE_COUNTER_ANALYTICS_ID }}
123
+ SITE_DISQUS_ID : ${{ vars.SITE_DISQUS_ID }}
123
124
shell : bash
124
125
run : |
125
126
set -e
126
127
[[ ${PROD:-false} == "true" ]] && \
127
128
OUTPUT=$(GA_ID=$SITE_GA_ID \
128
129
SWETRIX_ID=$SITE_SWETRIX_ID \
129
130
COUNTER_ANALYTICS_ID=$SITE_COUNTER_ANALYTICS_ID \
131
+ DISQUS_ID=$SITE_DISQUS_ID \
130
132
pnpm netlify deploy \
131
133
--auth ${{ env.NETLIFY_AUTH_TOKEN }} \
132
134
--site ${{ env.NETLIFY_SITE_ID }} \
Original file line number Diff line number Diff line change
1
+ ---
2
+ interface Props {
3
+ siteId: string
4
+ pageURL: string
5
+ pageIdentifier: string
6
+ }
7
+
8
+ const { siteId, pageURL, pageIdentifier } = Astro .props
9
+ ---
10
+
11
+ <div id =" disqus_thread" ></div >
12
+ <script define:vars ={ { siteId , pageURL , pageIdentifier }} >
13
+ var disqus_config = function () {
14
+ this.page.url = pageURL
15
+ this.page.identifier = pageIdentifier
16
+ }
17
+ ;(function () {
18
+ // DON'T EDIT BELOW THIS LINE
19
+ var d = document,
20
+ s = d.createElement('script')
21
+ s.src = `https://${siteId}.disqus.com/embed.js`
22
+ s.setAttribute('data-timestamp', new Date().toString())
23
+ ;(d.head || d.body).appendChild(s)
24
+ })()
25
+ </script >
26
+ <noscript >
27
+ Please enable JavaScript to view the
28
+ <a href =" https://disqus.com/?ref_noscript" >comments powered by Disqus.</a >
29
+ </noscript >
Original file line number Diff line number Diff line change @@ -49,5 +49,8 @@ export default {
49
49
swetrix : {
50
50
projectId : env . SWETRIX_ID ,
51
51
} ,
52
+ disqus : {
53
+ siteId : env . DISQUS_ID ,
54
+ } ,
52
55
}
53
56
}
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ const { author } = siteConfig
31
31
<div class =" prose p-4 border max-w-5xl" >
32
32
<slot />
33
33
</div >
34
+ <div class =" py-8 max-w-5xl" >
35
+ <slot name =" post-footer" />
36
+ </div >
34
37
</article >
35
38
</AppLayout >
36
39
Original file line number Diff line number Diff line change 1
1
---
2
2
import { CollectionEntry , getCollection } from ' astro:content'
3
3
4
+ import Disqus from ' @/components/Disqus.astro'
4
5
import PostLayout from ' @/layouts/PostLayout.astro'
6
+ import { getPluginConfig , isPluginEnabled } from ' @/utils/plugin'
5
7
6
8
export async function getStaticPaths() {
7
9
const allPosts = await getCollection (' leetcode-solutions' )
@@ -23,4 +25,14 @@ const { Content } = await entry.render()
23
25
24
26
<PostLayout frontmatter ={ entry .data } >
25
27
<Content />
28
+ {
29
+ isPluginEnabled (' disqus' ) && (
30
+ <Disqus
31
+ slot = " post-footer"
32
+ { ... getPluginConfig (' disqus' )}
33
+ pageURL = { Astro .url .href }
34
+ pageIdentifier = { Astro .url .pathname }
35
+ />
36
+ )
37
+ }
26
38
</PostLayout >
You can’t perform that action at this time.
0 commit comments