Newer
Older
find content/docs -type d -exec bash -c '
cd "{}" || exit
DIR=$(basename "$PWD")
TITLE=$(echo "$DIR" | sed -E "s/^(.)/\U\1/")
PAGES=$( (ls *.mdx 2>/dev/null | sed "s/\.mdx$//"; ls -d */ 2>/dev/null | sed "s#/##") | sort | jq -R . | jq -s . )
jq -n --arg title "$TITLE" --argjson pages "$PAGES" "{title: \$title, pages: \$pages}" > meta.json
' \;