Last active
August 15, 2022 13:36
-
-
Save Demindiro/d21b210016c4caeb1573399b4fbc8fce to your computer and use it in GitHub Desktop.
Simple static site generator. Licensed under the CC0 so do whatever you want.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for file in `find . -name '*.md'`; do | |
output=${file::-3}.html | |
if [[ `date -r "$file" "+%s"` -le `date -r "../$output" "+%s"` ]] | |
then | |
echo "Skipping $file" | |
continue | |
fi | |
mkdir -p ../$(dirname $output) | |
echo Generating $output from $file | |
cat << EOF > ../$output | |
<!DOCTYPE html> | |
`cat head.html` | |
<body> | |
`cat navigation.html` | |
<main> | |
`pandoc $file` | |
</main> | |
<footer> | |
<span>The content on this page is licensed under the CC BY-ND 4.0</span> | |
<a style="float:right" href="/md/$file">Source</a> | |
</footer> | |
</body> | |
EOF | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment