drm-pt.info/mkstork.sh
2023-07-19 16:06:47 +01:00

19 lines
504 B
Bash
Executable File

#!/usr/bin/env bash
cat <<EOF
[input]
base_directory = "content/artigos/"
stemming = "Portuguese"
url_prefix = "https://drmpt.pxto.pt/"
frontmatter_handling = "Parse"
files = [
EOF
find content/artigos -name "*.md" -printf "%P\n" | while read filename; do
slug="$(echo "$filename" | sed -e 's|/index.md||')"
date="$(cat "content/artigos/$filename" | yq --front-matter=extract .date | sed -e 's/ ..:..:..//' -e 's/-/\//g')"
echo " {url=\"$date/$slug\", title=\"\", path=\"$filename\"},"
done
echo "]"