mirror of
https://github.com/sbrow/thor.git
synced 2026-08-26 11:23:32 -04:00
feat: Added comment support.
This commit is contained in:
@@ -15,4 +15,3 @@
|
|||||||
- [ ] Nix build integration — main flake runs thor + tailwindcss instead of Hugo
|
- [ ] Nix build integration — main flake runs thor + tailwindcss instead of Hugo
|
||||||
- [ ] Copy-to-clipboard button on code blocks (was in Hugo's custom-head.html)
|
- [ ] Copy-to-clipboard button on code blocks (was in Hugo's custom-head.html)
|
||||||
- [ ] OpenGraph meta tags
|
- [ ] OpenGraph meta tags
|
||||||
- [ ] utteranc.es comments on posts
|
|
||||||
|
|||||||
+14
-1
@@ -66,17 +66,30 @@ render_site :: proc(pages: []Page, content_path: string, output_dir: string, bas
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_page_html :: proc(page: Page, site_title: string) -> string {
|
render_page_html :: proc(page: Page, site_title: string) -> string {
|
||||||
|
comments := ""
|
||||||
|
if page.type == .Post {
|
||||||
|
comments = `
|
||||||
|
<script src="https://utteranc.es/client.js"
|
||||||
|
repo="sbrow/sbrow.github.io"
|
||||||
|
issue-term="pathname"
|
||||||
|
label="Comment"
|
||||||
|
theme="github-dark"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
async></script>`
|
||||||
|
}
|
||||||
|
|
||||||
body := fmt.aprintf(
|
body := fmt.aprintf(
|
||||||
`<main>
|
`<main>
|
||||||
<article class="prose">
|
<article class="prose">
|
||||||
<h1>%s</h1>
|
<h1>%s</h1>
|
||||||
%s %s
|
%s %s
|
||||||
</article>
|
</article>%s
|
||||||
</main>
|
</main>
|
||||||
`,
|
`,
|
||||||
page.title,
|
page.title,
|
||||||
render_date(page),
|
render_date(page),
|
||||||
page.body_html,
|
page.body_html,
|
||||||
|
comments,
|
||||||
)
|
)
|
||||||
title := fmt.tprintf("%s | %s", page.title, site_title)
|
title := fmt.tprintf("%s | %s", page.title, site_title)
|
||||||
return render_chrome(title, body)
|
return render_chrome(title, body)
|
||||||
|
|||||||
Reference in New Issue
Block a user