Working on _blog_idx_for_index

This commit is contained in:
Stig-Ørjan Smelror 2024-01-30 15:07:30 +01:00
parent b426abd569
commit 3c6c8bae90

11
qsgen2
View File

@ -410,7 +410,7 @@ function _blogs() {
if (( ${#make_blog_array[@]} > 0 )); then if (( ${#make_blog_array[@]} > 0 )); then
# Regular blog creation process # Regular blog creation process
if [[ ! ${mode} ]]; then #if [[ ! ${mode} ]]; then
if [[ -f ${project_dir}/templates/${theme}/blogs.tpl ]]; then if [[ -f ${project_dir}/templates/${theme}/blogs.tpl ]]; then
local blog_tpl=$(<"${project_dir}/templates/${theme}/blogs.tpl") local blog_tpl=$(<"${project_dir}/templates/${theme}/blogs.tpl")
@ -487,15 +487,14 @@ function _blogs() {
echo "${blog_content}" > "${www_root}${blog_url}" echo "${blog_content}" > "${www_root}${blog_url}"
done done
else #else
# Declare the array to hold metadata strings for each blog # Declare the array to hold metadata strings for each blog
BLOG_META_STR_ARRAY=() BLOG_META_STR_ARRAY=()
# Iterate over make_blog_array # Iterate over make_blog_array
for blog in "$( cat ${blog_cache_file} )" for blog in "${#make_blog_array[@]}"
do do
local blog=$( echo ${blog[@]} | cut -d: -f1 )
local content="$(<"${blog}")" local content="$(<"${blog}")"
sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) ) sdate=( $( echo ${content} | grep DATE | sed "s|DATE\ ||" | sed "s|\-|\ |g" ) )
btitle=$( echo ${content} | grep BLOG_TITLE | cut -d' ' -f2- ) btitle=$( echo ${content} | grep BLOG_TITLE | cut -d' ' -f2- )
@ -517,7 +516,7 @@ function _blogs() {
# Now BLOG_META_STR_ARRAY contains the metadata string for each blog post # Now BLOG_META_STR_ARRAY contains the metadata string for each blog post
export BLOG_META_STR_ARRAY export BLOG_META_STR_ARRAY
fi #fi
else else
echo "${yellow}No new or updated Blogs detected.${end}" echo "${yellow}No new or updated Blogs detected.${end}"
@ -528,7 +527,7 @@ function _blog_idx_for_index() {
# This function generates the file blog/index.tmp.html # This function generates the file blog/index.tmp.html
# We use _blogs to get the data to create the blog index # We use _blogs to get the data to create the blog index
_blogs get_index #_blogs get_index
local debug=true local debug=true