Skip to content

Commit

Permalink
fix .html endings in crumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfect5th committed Jan 22, 2024
1 parent 26efedf commit 3da3b12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ rm -rf ./_site

generate_crumbs() {
HTML_PATH="$1"
PARTS=$(echo "$HTML_PATH" | sed -e 's/\(\/index\)\.html$//' | cut -d'/' -f3- | sed -e 's/\// /g')
ROOT="/"
[ -n "$SITE_ROOT" ] && ROOT="$SITE_ROOT"
PARTS=$(echo "$HTML_PATH" | sed -e 's/\(\/index\)\?\.html$//' | cut -d'/' -f3- | sed -e 's/\// /g')

echo '<nav class="crumbs"><ol>' >> "$HTML_PATH"

FULL_PATH="$SITE_ROOT"
printf '<li class="crumb"><a href="%s">Home</a></li>' "$SITE_ROOT" >> "$HTML_PATH"
FULL_PATH="$ROOT"
printf '<li class="crumb"><a href="%s">Home</a></li>' "$ROOT" >> "$HTML_PATH"
for PART in $PARTS; do
FULL_PATH="$FULL_PATH/$PART"
printf '<li class="crumb"><a href="%s">%s</a></li>' "$FULL_PATH" "$PART" >> "$HTML_PATH"
Expand Down

0 comments on commit 3da3b12

Please sign in to comment.