Skip to content

Commit

Permalink
Generating index
Browse files Browse the repository at this point in the history
  • Loading branch information
logandonley committed Sep 7, 2023
1 parent 9aa98fe commit 56bfe6f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions labs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ git submodule update --init --recursive

cd base || exit 1

excluded_dirs="base workshop-setup"
excluded_dirs="base workshop-setup public"
directories=$(ls -d ../*/ | grep -vE "($(echo $excluded_dirs | sed 's/ /|/g'))/")

# For each directory I need to do the following:
# hugo --minify --config {DIRECTORY_PATH}/config.toml --contentDir {DIRECTORY_PATH}/content/ --destination ../public/{DIRECTORY_NAME}
# Note: In the DIRECTORY_NAME part, I need to strip any relative path info and just get the actual directory name
echo "<html><head><title>CloudBees Labs</title></head><body>" >../public/index.html
echo "<h1>Current Labs</h1><ul>" >>../public/index.html

for dir in $directories; do
dir_name=$(basename $dir)
hugo --minify --config "${dir}/config.toml" --contentDir "${dir}/content/" --destination "../public/${dir_name}" --baseURL="/cloudbees-field-workshops/${dir_name}/"

echo "<li><a href=\"/cloudbees-field-workshops/${dir_name}/\">${dir_name}</a></li>" >>../public/index.html
done

echo "</ul></body></html>" >>../public/index.html

0 comments on commit 56bfe6f

Please sign in to comment.