Working on _blog_idx_for_index

This commit is contained in:
Stig-Ørjan Smelror 2024-01-30 15:19:33 +01:00
parent fac9789732
commit 7d964e7a1b

29
qsgen2
View File

@ -408,6 +408,9 @@ function _blogs() {
_blog_cache _blog_cache
if (( ${#make_blog_array[@]} > 0 )); then if (( ${#make_blog_array[@]} > 0 )); then
# Declare the array to hold metadata strings for each blog
BLOG_META_STR_ARRAY=()
# Regular blog creation process # Regular blog creation process
#if [[ ! ${mode} ]]; then #if [[ ! ${mode} ]]; then
@ -440,6 +443,13 @@ function _blogs() {
blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}" blog_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}"
blog_url="${blog_dir}/${blog_index}.html" 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}" if (${debug}) echo "_blogs: Processing ${blog}"
echo "${green}Generating blog ${blog_index}.html${end}" echo "${green}Generating blog ${blog_index}.html${end}"
@ -488,9 +498,6 @@ function _blogs() {
#else #else
# Declare the array to hold metadata strings for each blog
BLOG_META_STR_ARRAY=()
# Iterate over make_blog_array # Iterate over make_blog_array
#for blog_to_index in "${#make_blog_array[@]}" #for blog_to_index in "${#make_blog_array[@]}"
#do #do
@ -502,22 +509,10 @@ function _blogs() {
#blog_index=$(echo "${blog_index}" | sed 's/ /_/g; s/,//g; s/\.//g; s/://g; s/[()]//g') #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_dir="/blog/${sdate[2]}/${sdate[3]:l}/${sdate[4]}"
#blog_url="${blog_dir}/${blog_index}.html" #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 done
# Now BLOG_META_STR_ARRAY contains the metadata string for each blog post
#fi export BLOG_META_STR_ARRAY
else else
echo "${yellow}No new or updated Blogs detected.${end}" echo "${yellow}No new or updated Blogs detected.${end}"