# Loop through 'meta_key' array, search for the first occurence of the values in the HTML doc, and replace them with corresponding values in 'meta_value'.
# 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
for index in $(seq 0`expr "${#meta_key[@]}" - 1`);do
sed -i "0, /[\$][\$]${meta_key[$index]}[\$][\$]/ {s/[\$][\$]${meta_key[$index]}[\$][\$]/${meta_value[index]}/}"$1
sed -i "s/[\$][\$]${meta_key[$index]}[\$][\$]/${meta_value[index]}/g"$1
done
done
}
}
@ -108,6 +108,26 @@ md_to_html() {
done
done
}
}
gen_index_page(){# Generate an index page (site map) that includes links to the other pages
files=$(find $BASE_PATH/output -name "*.html")
for file in $files;do
title=$(cat $file| grep "<title>"| head -n 1| awk -F'[<>]''{print $3}')# Find the title of the web page
suffix=" - Two More Cents"
title=${title%"$suffix"}# Remove the website name from it
pub_date=$(cat $file| grep "date-published"| head -n 1| awk -F'[<>]''{print $3}')# Find the date published
prefix="Published on "# Find date published of webpage
pub_date=${pub_date#"$prefix"}# Remove the prefix from it
pub_date=${awk"{print $1$3}""$pub_date"}# Extract the month and year