1
0

Add openring to my blog

This commit is contained in:
Ryan Fox 2020-07-24 04:53:59 +00:00
parent b94070a26c
commit 4514023ae0
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
6 changed files with 82 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
ftp_url.txt
music/*
dist/
temp/
scripts/__pycache__/

View File

@ -18,7 +18,7 @@ dist/%.html: pages/%.md | dist
dist/%.html: pages/%.html | dist
cp $< $@
dist/blog/%.html: posts/%.md | dist/blog
dist/blog/%.html: posts/%.md dist/blog temp/openring.html
scripts/template_md.py $< $@
dist/music/%.mp3: music/%.mp3 | dist/music
@ -30,6 +30,17 @@ $(POST_LISTS): $(POSTS_OUT)
$(MUSIC_LISTS): music.json | $(OUTPUT_MUSIC)
scripts/gen_music.py $< $@
temp/openring.html: temp templates/openring.html scripts/openring/openring
scripts/openring/openring -l 256\
-s http://jakob.space/feed.xml \
-s https://drewdevault.com/feed.xml \
-s https://deadfishsw.wordpress.com/feed.xml \
< templates/openring.html \
> temp/openring.html
scripts/openring/openring:
cd scripts/openring && go build
dist/blog:
mkdir -p dist/blog
@ -39,6 +50,9 @@ dist/music:
dist:
mkdir dist
temp:
mkdir temp
.PHONY: clean upload
upload: dist

View File

@ -98,6 +98,9 @@ def template(content, path, ext, meta):
with open("music.json", "r", encoding="utf-8") as file:
music = json.loads(file.read())
meta["music_list"] = gen_music.gen_list(music, ext, limit=int(meta["music_list_limit"]), mini=True)
if "openring" in t_info[1] and t_info[1]["openring"] == "yes":
with open("temp/openring.html", "r", encoding="utf-8") as file:
meta["openring"] = file.read()
meta["head"] += "\n<link rel=\"canonical\" href=\""+meta["base"]+meta["full_path"]+"\"/>"
meta["content"] = content.format_map(meta)
if "description" not in meta and meta["ext"] == ".html":

View File

@ -166,6 +166,53 @@ pre {
white-space: pre-wrap;
}
div.articles {
display: flex;
padding-top: 32px;
padding-bottom: 32px;
}
div.article {
display: flex;
flex-direction: column;
padding-left: 16px;
padding-right: 16px;
}
div.article:first-of-type {
padding-left: 0;
border-right: solid 2px #AAAAAA;
}
div.article:last-of-type {
padding-right: 0;
border-left: solid 2px #AAAAAA;
}
div.article h4 {
font-size: 18px;
line-height: 1.4;
}
div.article p.summary {
font-size: 14px;
height: 100%;
}
div.article p.extra {
color: #555555;
font-size: 14px;
line-height: 1.5;
margin-top: 0;
margin-bottom: 0;
}
p.openring {
color: #555555;
font-size: 14px;
text-align: right;
}
@media only screen and (max-width: 950px) {
header {
height: 172px;
@ -270,7 +317,7 @@ pre {
font-size: 30px;
}
div.block {
div.block, div.articles {
padding-top: 24px;
padding-bottom: 24px;
}

12
templates/openring.html Normal file
View File

@ -0,0 +1,12 @@
<h3>Articles from blogs that I like</h3>
<div class="articles">
{{range .Articles}}
<div class="article">
<h4><a href="{{.Link}}">{{.Title}}</a></h4>
<p class="summary">{{.Summary}}</p>
<p class="extra">From <a href="{{.SourceLink}}">{{.SourceTitle}}</a><br/>
Published on {{.Date | date}}</p>
</div>
{{end}}
</div>
<p class="openring">Generated with the spectacular power of <a href="https://git.sr.ht/~sircmpwn/openring">openring</a></p>

View File

@ -1,8 +1,11 @@
meta: yes
head: <meta name="description" content="{description}"/>
<meta name="author" content="{author}"/>
openring: yes
template: page
<h1>{title}
<div class="title-subtext"><span>Published on {date} by {author}</span></div></h1>
{content}
<hr/>
{openring}