mirror of
https://gitlab.com/tavo-wasd/conex-pages.git
synced 2025-06-06 13:03:29 -06:00
tags
This commit is contained in:
parent
497a41f3ca
commit
407bbb4282
1 changed files with 3 additions and 5 deletions
|
@ -8,16 +8,14 @@ query_db() {
|
||||||
printf '%s\n' "$(PGPASSWORD=$DB_PASS psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -t -A -P pager=off -P border=0 -P format=unaligned -P tuples_only=on -c "$1")"
|
printf '%s\n' "$(PGPASSWORD=$DB_PASS psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -t -A -P pager=off -P border=0 -P format=unaligned -P tuples_only=on -c "$1")"
|
||||||
}
|
}
|
||||||
|
|
||||||
query_db "SELECT * FROM sites WHERE status = 'down' OR status = 'diff';" | while IFS='|' read -r _ directory _ _ _ _ _ _ _ title slogan banner json_data; do
|
query_db "SELECT * FROM sites WHERE status = 'down' OR status = 'diff';" | while IFS='|' read -r _ directory _ _ _ _ _ _ _ title slogan banner json_data _ _ tags; do
|
||||||
rm -f "$TMPDIR/site.md" "$TMPDIR/site.json"
|
rm -f "$TMPDIR/site.md" "$TMPDIR/site.json"
|
||||||
json_data="${json_data%|*}"
|
|
||||||
json_data="${json_data%|*}"
|
|
||||||
printf '%s' "$json_data" > "$TMPDIR/site.json"
|
printf '%s' "$json_data" > "$TMPDIR/site.json"
|
||||||
json2md -j "$TMPDIR/site.json" -t markdown -o "$TMPDIR/site.md"
|
json2md -j "$TMPDIR/site.json" -t markdown -o "$TMPDIR/site.md"
|
||||||
markdown_data="$(cat "$TMPDIR/site.md")"
|
markdown_data="$(cat "$TMPDIR/site.md")"
|
||||||
rm -f "$TMPDIR/site.md" "$TMPDIR/site.json"
|
rm -f "$TMPDIR/site.md" "$TMPDIR/site.json"
|
||||||
|
|
||||||
mkdir -p "content/$directory"
|
mkdir -p "content/$directory"
|
||||||
printf '%s\ndate: %s\ntitle: %s\ndescription: %s\nbanner: %s\ntags: %s\nlayout: single\n%s\n\n%s\n' \
|
printf '%s\ndate: %s\ntitle: %s\ndescription: %s\ntags: %s\nbanner: %s\nlayout: single\n%s\n\n%s\n' \
|
||||||
'---' "$(date -I)" "$title" "$slogan" "$banner" "$tags" '---' "$markdown_data" > "content/$directory/_index.md"
|
'---' "$(date -I)" "$title" "$slogan" "$tags" "$banner" '---' "$markdown_data" > "content/$directory/_index.md"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue