Better

· johanv's blog

#prose.sh

a few days ago i made a script to clone my existing blog to prose.sh and fix all the relative links so they would still point to my site

i improved the script to make all the links to other blog posts point to the post on johanv.prose.sh instead of the main blog johanv.net/blog

 1#!/bin/bash
 2IN=~/git/johanvandegriff/johanv.net/content/blog
 3OUT=~/nextcloud/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  > $OUT/`basename $file`
13done
14
15scp $OUT/*.md prose.sh:/
16scp $OUT/_styles.css prose.sh:/

update: fixed image and file links too