Skip to content
Snippets Groups Projects
meta-json.sh 304 B
Newer Older
  • Learn to ignore specific revisions
  • #!/bin/bash
    
    find content/docs -type d -exec bash -c 'cd "{}" && DIR=$(basename "$PWD"); TITLE=$(echo "$DIR" | sed -E "s/^(.)/\U\1/") && jq -n --arg title "$TITLE" --argjson pages "$(ls *.mdx 2>/dev/null | sed "s/\.mdx$//" | jq -R . | jq -s .)" "{title: \$title, pages: \$pages}" > meta.json' \;
    
    exit 0