diff --git a/website/build.sh b/website/build.sh index fbd578882..2301d1c9b 100755 --- a/website/build.sh +++ b/website/build.sh @@ -49,6 +49,20 @@ for file in $(find website/content/projects -name README.md); do mv "${file}" "${file%README.md}index.md" done +# Rename README.md based on directory structure within primers so we can have bundles and images stay working +find website/content/primers -type d | while read -r dir; do + if [[ -f "${dir}/README.md" ]]; then + # Check if the directory has subdirectories + if find "${dir}" -mindepth 1 -type d | read; then + # If it has subdirectories, rename README.md to _index.md + mv "${dir}/README.md" "${dir}/_index.md" + else + # If it does not have subdirectories, rename README.md to index.md + mv "${dir}/README.md" "${dir}/index.md" + fi + fi +done + find website/content -name '*.md' -print0 | xargs -0 "${sed_i[@]}" -e '/^$/d' cd website