Skip to content

Commit

Permalink
i would like to reorder the primers into folders (#165)
Browse files Browse the repository at this point in the history
this will make image handling easier and less fragile

my bash scripting is horrible so please improve if you can
  • Loading branch information
SallyMcGrath authored Feb 10, 2024
1 parent 0543668 commit eaf8b98
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions website/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/^<!--forhugo$/d' -e '/^forhugo-->$/d'

cd website
Expand Down

0 comments on commit eaf8b98

Please sign in to comment.