From 7d964e7a1bb569112034dc677db8da502e13bfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Tue, 30 Jan 2024 15:19:33 +0100 Subject: [PATCH] Working on _blog_idx_for_index --- qsgen2 | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/qsgen2 b/qsgen2 index 950fa32..95922d0 100755 --- a/qsgen2 +++ b/qsgen2 @@ -408,6 +408,9 @@ function _blogs() { _blog_cache if (( ${#make_blog_array[@]} > 0 )); then + + # Declare the array to hold metadata strings for each blog + BLOG_META_STR_ARRAY=() # Regular blog creation process #if [[ ! ${mode} ]]; then @@ -440,6 +443,13 @@ function _blogs() { blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" blog_url="${blog_dir}/${blog_index}.html" + if (${debug}) echo "_blogs: Adding data for ${blog} to array" + + # Concatenate all metadata into a single string for the current blog + local metadata_str="SDATE: ${sdate[@]}||BTITLE: ${btitle}||INGRESS: ${ingress}||URL: ${blog_url}" + # Append this metadata string to the array + BLOG_META_STR_ARRAY+=("${metadata_str}") + if (${debug}) echo "_blogs: Processing ${blog}" echo "${green}Generating blog ${blog_index}.html${end}" @@ -488,9 +498,6 @@ function _blogs() { #else - # Declare the array to hold metadata strings for each blog - BLOG_META_STR_ARRAY=() - # Iterate over make_blog_array #for blog_to_index in "${#make_blog_array[@]}" #do @@ -502,22 +509,10 @@ function _blogs() { #blog_index=$(echo "${blog_index}" | sed 's/ /_/g; s/,//g; s/\.//g; s/://g; s/[()]//g') #blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" #blog_url="${blog_dir}/${blog_index}.html" - - if ${debug}; then echo "_blogs: Adding data for ${blog} to array"; fi - - # Concatenate all metadata into a single string for the current blog - local metadata_str="SDATE: ${sdate[@]}||BTITLE: ${btitle}||INGRESS: ${ingress}||URL: ${blog_url}" - - # Append this metadata string to the array - BLOG_META_STR_ARRAY+=("${metadata_str}") - #done - - # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post - export BLOG_META_STR_ARRAY done - - #fi + # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post + export BLOG_META_STR_ARRAY else echo "${yellow}No new or updated Blogs detected.${end}"