bin/plaintext.sh: Generate 'build/_redirects' dynamically Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Wed, 19 Feb 2020 19:38:52 +0530
2 files changed,
3 insertions(+),
25 deletions(-)
D
_redirects
@@ -1,24 +0,0 @@
-http://icyphox.netlify.com/* http://icyphox.sh/:splat 301! -/txt/2019-09-17.txt /txt/2019-09-17 -/txt/2019-09-27.txt /txt/2019-09-27 -/txt/2019-10-17.txt /txt/2019-10-17 -/txt/2019-11-16.txt /txt/2019-11-16 -/txt/2019-in-review.txt /txt/2019-in-review -/txt/2020-01-18.txt /txt/2020-01-18 -/txt/digital-minimalism.txt /txt/digital-minimalism -/txt/disinfo.txt /txt/disinfo -/txt/fb50.txt /txt/fb50 -/txt/five-days-tty.txt /txt/five-days-tty -/txt/hacky-scripts.txt /txt/hacky-scripts -/txt/ig-opsec.txt /txt/ig-opsec -/txt/intel-conundrum.txt /txt/intel-conundrum -/txt/irc-for-dms.txt /txt/irc-for-dms -/txt/mailserver.txt /txt/mailserver -/txt/mnml-browsing.txt /txt/mnml-browsing -/txt/my-setup.txt /txt/my-setup -/txt/prosody.txt /txt/prosody -/txt/pycon-wrap-up.txt /txt/pycon-wrap-up -/txt/python-for-re-1.txt /txt/python-for-re-1 -/txt/rop-on-arm.txt /txt/rop-on-arm -/txt/ru-vs-gb.txt /txt/ru-vs-gb -/txt/save-org.txt /txt/save-org
M
bin/plaintext.sh
→
bin/plaintext.sh
@@ -9,13 +9,15 @@ dir=${dir%"$2"}
base="${dir:-/}" } +# prepare the '_redirects' file +printf 'http://icyphox.netlify.com/* http://icyphox.sh/:splat 301!\n' > build/_redirects for p in pages/blog/*.md; do basename "$p" no_ext="${base%.*}" [ "$base" != "_index.md" ] && { pandoc --quiet -s -f "markdown+gutenberg" \ "$p" -o "pages/txt/$no_ext.txt" - printf '%s\n' "/txt/$no_ext.txt /txt/$no_ext 301" >> _redirects + printf '%s\n' "/txt/$no_ext.txt /txt/$no_ext 301" >> build/_redirects } done