Hilfsskripte, um Blog-Posts in Hugos "content" Ordner zu migrieren
This commit is contained in:
parent
8c919b174e
commit
4c693622e5
23
sb/scripts/asset-extensions-in-folder-Blog.sh
Normal file
23
sb/scripts/asset-extensions-in-folder-Blog.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#welche Dateiendungen sind in den Markdown-Dateien in Verweisen enthalten:
|
||||||
|
grep -r -E '\.\w\w\w+\)' Blog/ | grep -v -E '\.html\)' \
|
||||||
|
| grep -v -E '\.de\)' | grep -v -E '\.org\)' | grep -v -E '\.nrw\)' \
|
||||||
|
| cut -d')' -f 1 | rev | cut -d'.' -f 1 | rev | sort -u
|
||||||
|
|
||||||
|
# jpeg
|
||||||
|
# jpg
|
||||||
|
# JPG
|
||||||
|
# mp4
|
||||||
|
# pdf
|
||||||
|
# png
|
||||||
|
|
||||||
|
# 1970520 => AKRK.md
|
||||||
|
# education => GwR-Tagung
|
||||||
|
|
||||||
|
# $grep -r -E '\.\w\w\w+\)' Blog/ | grep -v -E '\.html\)' | grep -v -E '\.de\)' | grep -v -E '\.org\)' | grep -v -E '\.nrw\)' | cut -d')' -f 1 | grep educa
|
||||||
|
# Blog/2024-09-17-GwR-Tagung.md:Unter dem spannenden Motto „...hier sollte eigentlich ein Titel stehen“ fand die diesjährige [GwR-Tagung](https://gwr.education
|
||||||
|
|
||||||
|
# $grep -r -E '\.\w\w\w+\)' Blog/ | grep -v -E '\.html\)' | grep -v -E '\.de\)' | grep -v -E '\.org\)' | grep -v -E '\.nrw\)' | cut -d')' -f 1 | grep 1970
|
||||||
|
# Blog/2024-10-02 AKRK.md:Wie OER insgesamt didaktische Prozesse verändern können und die Perspektive auf die Lernenden richten, beleuchtet auch die Forschung von [Eric Werth und Katherine Williams](https://doi.org/10.1080/02680513.2021.1970520
|
||||||
|
|
||||||
|
#welche Zeilen in Markdown Dateien enthalten "Asset"-Links,, die nicht in den Wordpress-Uploads vorhanden sind?
|
||||||
|
grep -r -E '\.\w\w\w+\)' Blog/ | grep -v -E '\.html\)' | grep -v -E '\.de\)' | grep -v -E '\.org\)' | grep -v -E '\.nrw\)' | cut -d')' -f 1 | grep -v 'oer\.comm'
|
39
sb/scripts/move-blog-posts-to-hugo-content-dir.sh
Executable file
39
sb/scripts/move-blog-posts-to-hugo-content-dir.sh
Executable file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
working_directory=$(basename $(pwd))
|
||||||
|
if [ "$working_directory" != "FOERBICO" ]; then
|
||||||
|
echo "not in root dir 'FOERBICO'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OURTMPDIR='tmp-8JmqbYUnu'
|
||||||
|
|
||||||
|
# script im root dir ausführen
|
||||||
|
find Blog -type f -name '*.md' | while read FILE ; do
|
||||||
|
echo 'erstelle Verzeichnis für Post' $FILE
|
||||||
|
post_directory=$(grep 'oerCommunityPermalink' "$FILE" | cut -d'/' -f 4) # "..." beachtet Leerzeichen im Dateinamen
|
||||||
|
|
||||||
|
mkdir -p $OURTMPDIR
|
||||||
|
echo $post_directory >> $OURTMPDIR/permalink-all.txt
|
||||||
|
|
||||||
|
mkdir -p sb/content/$post_directory
|
||||||
|
|
||||||
|
echo 'kopiere' $FILE 'ins Verzeichnis als index.md'
|
||||||
|
cp "$FILE" sb/content/$post_directory/index.md
|
||||||
|
|
||||||
|
#assets aus "wp-content" holen
|
||||||
|
asset_link_list=$(grep -Eo "(http|https)://[a-zA-Z0-9./?=_%:-]*" "$FILE" | grep wp-content | grep "oer\.community" | sed 's/http:/https:/g' | sort -u)
|
||||||
|
|
||||||
|
cd "sb/content/$post_directory/"
|
||||||
|
|
||||||
|
for wp_content_asset in $asset_link_list
|
||||||
|
do
|
||||||
|
asset_output_file_name=$(echo $wp_content_asset | rev | cut -d'/' -f 1 | rev)
|
||||||
|
curl -s --remote-name $wp_content_asset --output "$asset_output_file_name"
|
||||||
|
#rm $(basename $wp_content_asset)
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ../../../
|
||||||
|
|
||||||
|
done
|
Loading…
Reference in a new issue