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 5f87ef7
Show file tree
Hide file tree
Showing 5 changed files with 55 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'
29 changes: 24 additions & 5 deletions src/layouts/article.layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,31 @@ export default function articleLayout (args) {
}
</section>
<!--
<footer>
<p>Footer notes or related info here...</p>
</footer>
-->
<!--
<footer>
</footer>
-->
</article>
<hr/>
<giscus-widget
data-repo="bcomnes/bret.io"
data-repo-id="MDEwOlJlcG9zaXRvcnk3MjgwNzcxMg=="
data-category="Announcements"
data-category-id="DIC_kwDOBFb1IM4CN-FH"
data-mapping="og:title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</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 5f87ef7

Please sign in to comment.