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:
120120 SITE_GA_ID : ${{ vars.SITE_GA_ID }}
121121 SITE_SWETRIX_ID : ${{ vars.SITE_SWETRIX_ID }}
122122 SITE_COUNTER_ANALYTICS_ID : ${{ vars.SITE_COUNTER_ANALYTICS_ID }}
123+ SITE_DISQUS_ID : ${{ vars.SITE_DISQUS_ID }}
123124 shell : bash
124125 run : |
125126 set -e
126127 [[ ${PROD:-false} == "true" ]] && \
127128 OUTPUT=$(GA_ID=$SITE_GA_ID \
128129 SWETRIX_ID=$SITE_SWETRIX_ID \
129130 COUNTER_ANALYTICS_ID=$SITE_COUNTER_ANALYTICS_ID \
131+ DISQUS_ID=$SITE_DISQUS_ID \
130132 pnpm netlify deploy \
131133 --auth ${{ env.NETLIFY_AUTH_TOKEN }} \
132134 --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 {
4949 swetrix : {
5050 projectId : env . SWETRIX_ID ,
5151 } ,
52+ disqus : {
53+ siteId : env . DISQUS_ID ,
54+ } ,
5255 }
5356}
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ const { author } = siteConfig
3131 <div class =" prose p-4 border max-w-5xl" >
3232 <slot />
3333 </div >
34+ <div class =" py-8 max-w-5xl" >
35+ <slot name =" post-footer" />
36+ </div >
3437 </article >
3538</AppLayout >
3639
Original file line number Diff line number Diff line change 11---
22import { CollectionEntry , getCollection } from ' astro:content'
33
4+ import Disqus from ' @/components/Disqus.astro'
45import PostLayout from ' @/layouts/PostLayout.astro'
6+ import { getPluginConfig , isPluginEnabled } from ' @/utils/plugin'
57
68export async function getStaticPaths() {
79 const allPosts = await getCollection (' leetcode-solutions' )
@@ -23,4 +25,14 @@ const { Content } = await entry.render()
2325
2426<PostLayout frontmatter ={ entry .data } >
2527 <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+ }
2638</PostLayout >
You can’t perform that action at this time.
0 commit comments