Jekyll-Post-Links generieren
Dies ist ein kleines Script zum Anzeigen möglicher Post-Referenzen zum Einfügen in Markdown-Dateien. Mir spart es ein wenig händische Arbeit.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
c=1
echo ""
echo "just copy one of the following link jerkyll / markdown links and copy to your post:"
echo ""
# set this variable with relative path to your posts
RELATIVE_PATH="../"
FILES="$(ls $RELATIVE_PATH -p | grep -v /)"
for n in $FILES
do
# remove file ending
REF="$(echo $n | cut -d'.' -f1)"
# stripping down to the raw title
TITLE="$(cat $RELATIVE_PATH$n | grep 'title:' | cut -d'"' -f2)"
echo ""
echo "$c: [\"$TITLE\"]({% post_url $REF %})"
c=$((c+1))
done
#
Die Ausgabe sieht dann wie folgt aus.
λ sh post_links.sh
just copy one of the following link jerkyll / markdown links and copy to your post:
1: ["Was tun mit dem Geld? Sparen!"]({% post_url 2018-08-11-gk1-sparen %})
2: ["Warum Sparen? Aka wie funktioniert unsere Rente?"]({% post_url 2018-08-18-gk2-rente %})
3: ["Grundlagen der passiven Geldanlage"]({% post_url 2018-08-29-gk3-grundlagen-der-passiven-geldanlage %})