Best

· johanv's blog


last year i made a script to clone my existing blog to prose.sh

today i improved the script to also copy the images over from the main blog johanv.net/blog but keep the original link for any non-image files, since only images can be uploaded to prose.sh

 1#!/bin/bash
 2IN=~/git/johanvandegriff/johanv.net/content/blog
 3OUT=~/nextcloud/projects/website/prose.sh
 4BASEURL=https://johanv.net/
 5TMP="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"
 6
 7for file in $IN/*.md; do
 8  cat $file \
 9  | sed 's,](/blog,'$TMP',g' \
10  | sed 's,](/,]('$BASEURL',g' \
11  | sed 's,'$TMP',](,g' \
12  | sed 's,](/images/[^/]*/,](/,g' \
13  | sed 's,](/images/,](/,g' \
14  | sed 's,](/files/,]('$BASEURL'blog/files/,g' \
15  > $OUT/`basename $file`
16done
17
18scp $OUT/*.md prose.sh:/
19scp $OUT/_styles.css prose.sh:/
20if [[ "$1" == "--images" ]]; then
21  scp -r $IN/images/ prose.sh:/
22fi