website/articles/generate_listing.sh
2019-06-19 19:14:23 +02:00

28 lines
384 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
cat << EOF
---
title: Articles
---
<ul>
EOF
for file in *.md; do
if [ $file = "index.md" ]; then
continue
fi
link=$(basename $file .md).html
date=$(sed -n 's/date: \(.*\)/\1/p' $file)
title=$(sed -n 's/title: \(.*\)/\1/p' $file)
echo "<li>$date: <a href=\"$link\">$title</a></li>"
done
cat << EOF
</ul>
EOF