website/scripts/blogposts.bash

55 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
cat <<HDR
<div class="inner">
<h1>Posts</h1>
<dl> <!-- no longer me -->
HDR
for blog_post_md in blog/*.md; do
date=$(grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}' <<<"$blog_post_md")
title=$(grep -m 1 '^#\s\+' "$blog_post_md" | sed 's/^#\s\+//')
html=$(sed 's/\.md$/.html/' <<<"$blog_post_md")
cat <<INNIE
<dt>$date</dt>
<dd><a href="$html">$title</a></dd>
INNIE
done
cat <<FTR # Short for Fetterman
</dl> <!-- no longer on the dl -->
<h2>Other People's Posts</h2>
{{range .Articles}}
<div>
<h4 class="title" dir="auto">
<a href="{{.Link}}" target="_blank" rel="noopener">{{.Title}}</a>
</h4>
<p class="summary" dir="auto">{{.Summary}}</p>
<small class="source">
via <a href="{{.SourceLink}}">{{.SourceTitle}}</a>
</small>
<small class="date">{{.Date | datef "January 2, 2006"}}</small>
</div>
{{end}}
</br></br>
<small>
<p>
Generated by
<a href="https://git.sr.ht/~sircmpwn/openring">openring</a>
</p>
</small>
</div>
<style>
.webring .title {
margin: 0;
}
.webring .summary {
font-size: 0.8rem;
flex: 1 1 0;
}
</style>
FTR