From ad2bc3a3ad2e49f21eea9545239d8f9b2c3b53d2 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Mon, 8 Jan 2024 22:46:17 -0500 Subject: [PATCH] Finished code for generating index file; created a separate function for adding header and footer to index file --- build.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index e596747..15240fc 100755 --- a/build.sh +++ b/build.sh @@ -68,6 +68,18 @@ add_header_and_footer() { mv $BASE_PATH/temp/temp.html $1 } +add_header_and_footer_to_index() { +# Add header + cat $BASE_PATH/header.html | head -n -1 | cat - $1 > $BASE_PATH/temp/temp.html # For the index page, remove the last line of the header (date published) + +# Add footer + echo >> $BASE_PATH/temp/temp.html + cat $BASE_PATH/footer.html >> $BASE_PATH/temp/temp.html + +# Move temp file to original location + mv $BASE_PATH/temp/temp.html $1 +} + replace_vars() { # Loop through 'meta_key' array, search for all occurences of the values in the HTML doc, and replace them with corresponding values in 'meta_value'. for index in $(seq 0 `expr "${#meta_key[@]}" - 1`); do @@ -136,6 +148,9 @@ gen_sorted_file_list() { # Generate a list of the HTMl files, sorted by when the } gen_index_page() { # Generate an index page (site map) that includes links to the other pages + + index_file_html="