Compare commits

...

4 Commits

4 changed files with 85 additions and 7 deletions
+2 -2
View File
@@ -96,9 +96,9 @@ do
title="$name"
cat "$entry" | eval "POST_TITLE=\"${title}\" ${postprocess_cmd}" > "$dest"
else
title="$(grep --regexp "^\# " --max-count 1 "$entry" | cut -c3-)"
title="$(grep --regexp "^# " --max-count 1 "$entry" | cut -c3-)"
export POST_TITLE="$title"
cat "$entry" | grep --regexp "^\# " --invert-match | eval "$postprocess_cmd" > "$dest"
cat "$entry" | grep --regexp "^# " --invert-match | eval "$postprocess_cmd" > "$dest"
fi
cat "$entry" | eval "$extract_args_cmd" > "${dest}.args"
echo "Processed ${entry#$(dirname ${BLOGS})/} to ${dest#$(dirname ${SRC})/}"
+4 -4
View File
@@ -1,8 +1,8 @@
#!
SRC="$1"
PAGE="$1"
SITE_URL="$2"
DATE_PUBLISHED="${DATE_PUBLISHED:-$(basename "${SRC}" | cut -c1-10)}"
CANONICAL_URL="${SITE_URL}/blog/$(basename "${SRC}")"
DATE_PUBLISHED="${DATE_PUBLISHED:-$(basename "${PAGE}" | cut -c1-10)}"
CANONICAL_URL="${SITE_URL}/blog/$(basename "${PAGE}")"
#!
<!doctype html>
@@ -57,7 +57,7 @@ fi
<section class='e-content'>
#!
pp "${SRC}"
pp "${PAGE}"
#!
</section>
+1 -1
View File
@@ -10,7 +10,7 @@ pp "${SHARE}"/components/head.upphtml
<body>
#!
pp "${SHARE}"/components/navbar.upphtml
pp "$1"
pp "$1" "$2"
#!
</body>
</html>
+78
View File
@@ -0,0 +1,78 @@
#!
PAGE="$1"
SITE_URL="$2"
export TITLE="Joe Carstairs"
export DESCRIPTION="Joe Carstairs' personal website"
POSTS="$(ls "${SRC}/blog/" | grep "^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\.blog.upphtml$")"
set --
for post in $POSTS
do
this_year="$( echo "$post" | cut -c1-4 )"
has_this_year=0
for year in $@
do
if [ "$this_year" = "$year" ]
then
has_this_year=1
break
fi
done
if [ $has_this_year -eq 0 ]
then
set -- $@ "$this_year"
fi
done
YEARS="$@"
pp "${SHARE}"/components/meta.upphtml
#!
<main>
<section class='h-feed'>
<h1>My blog</h1>
<aside>
<p>This blog is written by <a class='p-author h-card' href='/'>Joe Carstairs</a>.</p>
<p hidden><a class='u-url' href='${SITE_URL}/blog'>Permalink</a></p>
</aside>
<section>
<p><a href='/blog/subscribe'>How to subscribe to this blog</a></p>
</section>
#!
for year in $YEARS; do
#!
<h2>${year}</h2>
<ul>
#!
for post in $POSTS; do if [ "$(echo "${post}" | cut -c1-4)" = "$year" ]; then
title="$(grep "^export TITLE=" "${SRC}/blog/${post}" | cut -c15-)"
title="${title::${#title}-16}"
date_published="$(echo "${post}" | cut -c1-10)"
href="${SITE_URL}/blog/$(echo "$post" | cut -c1-10).html"
#!
<li class='h-entry'>
<h3><a class='u-url p-name' href='${href}'>${title}</a></h3>
#!
DATE="${date_published}" CLASS="dt-published" pp "${SHARE}/components/formatted_date.upphtml"
#!
</li>
#!
fi; done
#!
</ul>
#!
done
#!
</section>