Add blog index content to /blog/index.html

This commit adds the blog index content to the file /blog/index.html. The function  replaces the  placeholder in the content with the actual blog index list. After the replacement, the updated content is written to the file /blog/index.html. The commit also includes debug messages to display the content of  before writing it to the file.
This commit is contained in:
Stig-Ørjan Smelror 2024-02-12 21:04:16 +01:00
parent cce973f2cd
commit 7ce545e423

5
qsgen2
View File

@ -914,6 +914,11 @@ function _blog_index() {
if (${debug}) _msg debug "_blog_index: Replacing BODY with content of ${project_dir}/blog/index.tmp.html" 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}") )
if (${debug}); then
_msg debug "_blog_index: Writing ${www_root}/blog/index.html"
_msg debug "_blog_index: Content of blog_index_content"
_msg info "${blog_index_content}"
fi
echo "${blog_index_content}" > ${www_root}/blog/index.html echo "${blog_index_content}" > ${www_root}/blog/index.html
_f_last_updated ${www_root}/blog/index.html _f_last_updated ${www_root}/blog/index.html
fi fi