Skip to content

Commit

Permalink
Enable comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed May 22, 2024
1 parent f823ca3 commit 7eb4e3f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
"engines": {
"node": ">=16.0.0",
"npm": ">=8.3.1"
},
"dependencies": {
"giscus": "^1.5.0"
}
}
26 changes: 26 additions & 0 deletions src/giscus.json.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @template T
* @typedef {import('top-bun').TemplateFunction<T>} TemplateFunction
*/

/** @type {TemplateFunction<{
* siteName: string,
* description: string,
* siteUrl: string,
* authorName: string,
* authorUrl: string,
* authorImgUrl: string
* layout: string,
* publishDate: string
* title: string
* }>} */
export default async ({
vars: {
siteUrl
}
}) => {
return JSON.stringify({
origins: [siteUrl],
originsRegex: ['http://localhost:[0-9]+']
}, null, ' ')
}
1 change: 1 addition & 0 deletions src/layouts/article.layout.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'giscus'
28 changes: 23 additions & 5 deletions src/layouts/article.layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,30 @@ export default function articleLayout (args) {
}
</section>
<!--
<footer>
<p>Footer notes or related info here...</p>
</footer>
-->
<!--
<footer>
</footer>
-->
</article>
<hr/>
<giscus-widget
id="comments"
repo="bcomnes/bret.io"
repoid="MDEwOlJlcG9zaXRvcnk3MjgwNzcxMg=="
category="Announcements"
categoryid="DIC_kwDOBFb1IM4CN-FH"
mapping="og:title"
strict="0"
reactionsenabled="1"
emitmetadata="0"
inputposition="top"
theme="preferred_color_scheme"
lang="en"
loading="lazy"
></giscus-widget>
${breadcrumb({ pathSegments })}
`

Expand Down
1 change: 1 addition & 0 deletions src/layouts/book-review.layout.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './article.layout.client.js'

0 comments on commit 7eb4e3f

Please sign in to comment.