From 30eff46640abae3232078a9716f4b8ddadce844e Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 15 Jul 2020 21:20:25 +0200 Subject: [PATCH] alter the script so that the finished build get's built into the dist/ directory --- blog-refresh.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/blog-refresh.sh b/blog-refresh.sh index 32c49cb..bd2035f 100755 --- a/blog-refresh.sh +++ b/blog-refresh.sh @@ -3,15 +3,15 @@ blog_domain='https://lucy.moe/' output() { - echo "$1" >> index-alt.html + echo "$1" >> dist/index-alt.html } output_entrylist() { - echo "$1" >> entry_list.md + echo "$1" >> dist/entry_list.md } output_rss() { - echo "$1" >> rss.xml + echo "$1" >> dist/rss.xml } add_header() { @@ -61,18 +61,18 @@ create_entry() { path="$9" outpath="$(basename "$path" .md).html" # convert new markdown posts to html - pandoc -s --css=/static/css/sakura-vader.css "$path" src/footer/footer.md -t html5 -f markdown -o "$outpath" + pandoc -s --css=/css/sakura-vader.css "$path" src/footer/footer.md -t html5 -f markdown -o "dist/$outpath" # then add it to the index title="$(grep -h '^title: ' "$path" | sed 's/title: //g')" created=$(grep -h '^date: ' "$path" | sed 's/date: //g') html_entry "$outpath" "$created" "$title" - rss_entry "$title" "$outpath" + rss_entry "$title" "dist/$outpath" } convert_static() { path="$9" outpath="$(basename "$path" .md).html" - pandoc -s --css=/static/css/sakura-vader.css "$path" -t html5 -f markdown -o "$outpath" + pandoc -s --css=/css/sakura-vader.css "$path" -t html5 -f markdown -o "dist/$outpath" } has_updates() { @@ -86,11 +86,10 @@ has_updates() { } cd /home/lucy/blog-content/ -rm -f index.html -rm -f entry_list.md -rm -f rss.xml +rm -R dist/* +rsync --delete -avxt static/ dist/ add_header ls -ltu src/posts/*.md | tail -n+1 | while read f; do create_entry $f; done ls -ltu src/*.md | tail -n+1 | while read f; do convert_static $f; done add_footer -pandoc -s --css=/static/css/sakura-vader.css src/index/index_header.md entry_list.md src/index/after-entry-list.md src/footer/footer.md -o index.html +pandoc -s --css=/css/sakura-vader.css src/index/index_header.md dist/entry_list.md src/index/after-entry-list.md src/footer/footer.md -o dist/index.html