Fix debug flag in _blogs function and add debug messages in _blog_index function

In the _blogs function, the debug flag was set to true, which caused unnecessary debug output. Changed it to false.

In the _blog_index function, added debug messages to indicate the replacement of sitename and tagline, as well as the replacement of BODY with the content of the blog index file.

This commit fixes the debug flag and adds debug messages for better troubleshooting and understanding of the code.
This commit is contained in:
Stig-Ørjan Smelror 2024-02-12 21:01:15 +01:00
parent caeb4af27a
commit cce973f2cd

4
qsgen2
View File

@ -623,7 +623,7 @@ function _blogs() {
local debug=true local debug=true
else else
# If you want to debug this function only, set this to true # If you want to debug this function only, set this to true
local debug=true local debug=false
fi fi
# Running function _list_blogs # Running function _list_blogs
@ -909,7 +909,9 @@ function _blog_index() {
local blog_index_tpl=$(<${project_dir}/themes/${theme}/blog_index.tpl) local blog_index_tpl=$(<${project_dir}/themes/${theme}/blog_index.tpl)
local blog_index_list=$(<${project_dir}/blog/index.tmp.html) local blog_index_list=$(<${project_dir}/blog/index.tmp.html)
if (${debug}) _msg debug "_blog_index: Replacing sitename and tagline"
local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${site_name}|gs; s|#tagline|${site_tagline}|gs") local blog_index_content=$(echo "${blog_index_tpl}" | perl -pe "s|#sitename|${site_name}|gs; s|#tagline|${site_tagline}|gs")
if (${debug}) _msg debug "_blog_index: Replacing BODY with content of ${project_dir}/blog/index.tmp.html"
blog_index_content=$( awk -v new_body="$blog_index_list" '{sub(/BODY/, new_body)} 1' <(echo "${blog_index_content}") ) blog_index_content=$( awk -v new_body="$blog_index_list" '{sub(/BODY/, new_body)} 1' <(echo "${blog_index_content}") )
echo "${blog_index_content}" > ${www_root}/blog/index.html echo "${blog_index_content}" > ${www_root}/blog/index.html