Skip to content

Commit

Permalink
merge from upstream/main
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 26efedfe3f7aa315e3293063808da9e7d938e28e
Author: Mitchell Burton <[email protected]>
Date:   Mon Jan 22 06:32:39 2024 -0800

    add CRUMBS env var

commit b392936cf37f001d960d26103dd0fcb9c7bd0d39
Author: Mitchell Burton <[email protected]>
Date:   Mon Jan 22 06:26:36 2024 -0800

    add breadcrumbs nav
  • Loading branch information
Perfect5th committed Jan 22, 2024
1 parent 3d3ab03 commit 36859ac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ FILES=$(find ./markdown -type f -name '*.md')

rm -rf ./_site

generate_crumbs() {
HTML_PATH="$1"
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"
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"
done

echo "</ol></nav>" >> "$HTML_PATH"
}

convert_file() {
HTML_PATH=$(echo "$1" | sed -e 's/\.md$/\.html/' | sed -e 's/^\.\/markdown/\.\/_site/')

Expand All @@ -26,6 +42,11 @@ convert_file() {
sed -e "s:{{SITE_ROOT}}:$SITE_ROOT:g" ./templates/base.html | \
sed -e "s:{{PAGE_TITLE}}:$PAGE_TITLE:g" \
> "$HTML_PATH"

if [ "$CRUMBS" = "YES" ]; then
generate_crumbs "$HTML_PATH"
fi

markdown --html4tags "$1" >> "$HTML_PATH"
cat ./templates/close.html >> "$HTML_PATH"
}
Expand Down
1 change: 1 addition & 0 deletions env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export SITE_ROOT="/blog"
export SITE_TITLE="Perfect5th 2.0"
export CRUMBS="YES"
4 changes: 4 additions & 0 deletions markdown/subpage/non-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Non Index page

This is a page that is not the index of the directory it is in.

0 comments on commit 36859ac

Please sign in to comment.