From cce973f2cd92bed24f1bb8d8937e1aad3ffb412d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Mon, 12 Feb 2024 21:01:15 +0100 Subject: [PATCH] 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. --- qsgen2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qsgen2 b/qsgen2 index 8ad08a6..bf79fb0 100755 --- a/qsgen2 +++ b/qsgen2 @@ -623,7 +623,7 @@ function _blogs() { local debug=true else # If you want to debug this function only, set this to true - local debug=true + local debug=false fi # 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_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") + 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}") ) echo "${blog_index_content}" > ${www_root}/blog/index.html