Skip to content

Commit 455251b

Browse files
authored
Merge pull request #8 from parente/parente/utterances
Add support for utteranc.es
2 parents 8892c8e + 9513676 commit 455251b

File tree

6 files changed

+45
-16
lines changed

6 files changed

+45
-16
lines changed

generate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
class Page(TypedDict):
3838
"""A page on the site."""
3939

40+
# Allow comments on the page
41+
allow_comments: NotRequired[bool]
4042
# Author of the page, if different from SITE_AUTHOR
4143
author: NotRequired[str]
4244
# Brief introductory comment above the start of a page *in HTML*
@@ -198,6 +200,8 @@ def execute(self, path: str, page: Page):
198200
page["author"] = SITE_AUTHOR
199201
if "excerpt" not in page:
200202
page["excerpt"] = self._build_excerpt(text)
203+
if "allow_comments" not in page:
204+
page["allow_comments"] = True
201205
page["src"] = path
202206
page["slug"] = self._build_page_slug(page)
203207
page["html"] = html

pages/20241129-obsidian-webclipper-config/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ PARAMETER temperature 0.25
6666
1. Click the Obsidian icon in the Firefox toolbar and then click the gear to open the settings screen again.
6767
2. Click _Interpreter_ and enable it.
6868
3. Click _Add provider_ and enter details about the local Ollama server.
69-
- _Provider_: `Ollama`
70-
- _Base URL_: `http://127.0.0.1:11434/api/chat`
71-
- _API key_: `ollama`
69+
- _Provider_: `Ollama`
70+
- _Base URL_: `http://127.0.0.1:11434/api/chat`
71+
- _API key_: `ollama`
7272
4. Click _Add model_ and enter details about the local Ollama server.
73-
- _Provider_: `Ollama`
74-
- _Display name_: `Llama 3.2 (ctx=32k, t=0.25)`
75-
- _Model ID_: `llama3.2:ctx32k-t0.25` (the ID used when running `ollama create` earlier)
73+
- _Provider_: `Ollama`
74+
- _Display name_: `Llama 3.2 (ctx=32k, t=0.25)`
75+
- _Model ID_: `llama3.2:ctx32k-t0.25` (the ID used when running `ollama create` earlier)
7676

7777
## Create a new template
7878

pages/about/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: About
33
excerpt: Who do I say / think I am?
4+
allow_comments: false
45
---
56

67
<img alt="Image of Peter Parente" class="inlineRight profilePic" width="140" height="140" src="https://s.gravatar.com/avatar/c7d6948add10f2d0ea4928e4995d6b32?s=128" />

static/css/site.css

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ iframe {
8080
}
8181

8282
#siteMeta.row {
83-
padding-top: 0;
8483
margin: 0;
8584
}
8685

@@ -89,14 +88,19 @@ iframe {
8988
}
9089

9190
#siteMeta h3 {
92-
margin-top: 30px;
91+
margin-top: 0;
9392
}
9493

95-
#pageMeta {
96-
margin-top: 60px;
94+
95+
#siteMeta i {
96+
padding-right: 0.25em;
9797
}
9898

99-
#pageMeta .excerpt {
99+
#nextRead h3 {
100+
margin-top: 0;
101+
}
102+
103+
#nextRead .excerpt {
100104
font-style: italic;
101105
}
102106

@@ -114,8 +118,12 @@ iframe {
114118
margin: 1em 0px;
115119
}
116120

117-
#siteMeta i {
118-
padding-right: 0.25em;
121+
#mainColumn {
122+
margin-bottom: 60px;
123+
}
124+
125+
#userComments .utterances {
126+
max-width: inherit !important;
119127
}
120128

121129
.footerSection {
@@ -199,6 +207,9 @@ body .gist {
199207

200208
.commentary {
201209
font-size: 0.8em;
210+
color: #999;
211+
line-height: 1.1em;
212+
margin-bottom: 30px;
202213
}
203214

204215
.container{

templates/page.mako

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,26 @@
1515
<p class="pageDate">${page['date'].strftime('%B %d, %Y')}</p>
1616
% endif
1717
% if 'author_comment' in page:
18-
<p class="commentary"><i class="fa fa-comment-o"></i> ${page['author_comment']}<hr /></p>
18+
<p class="commentary"><i class="fa fa-comment-o"></i> ${page['author_comment']}</p>
1919
% endif
2020
${page['html']}
2121
</%block>
2222

2323
<%block name="pageMeta">
24+
% if 'allow_comments' in page:
25+
<div class="footerSection" id="userComments">
26+
<script src="https://utteranc.es/client.js"
27+
repo="parente/blog"
28+
issue-term="[${page['slug']}]"
29+
label="thread"
30+
theme="github-light"
31+
crossorigin="anonymous"
32+
async>
33+
</script>
34+
</div>
35+
% endif
2436
% if 'next' in page:
25-
<div class="footerSection" id="pageMeta">
37+
<div class="footerSection" id="nextRead">
2638
<h3>Another Read: <a href="${site_root}/${page['next']['slug']}">${page['next']['title']} &#187;</a></h3>
2739
<div class="excerpt">${page['next']['excerpt']}</div>
2840
</div>

templates/shell.mako

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
<%block name="mainColumn" />
3636
</article>
3737

38-
<!-- Meta -->
38+
<!-- Page Meta -->
3939
<%block name="pageMeta" />
4040

41+
<!-- Site Meta -->
4142
<div class="row footerSection gx-5" id="siteMeta">
4243

4344
<div class="col-md-3" id="social">

0 commit comments

Comments
 (0)