Refactor _blog_index function in qsgen2 script

This commit refactors the _blog_index function in the qsgen2 script. The changes include:

- Commenting out the debug messages for the content of blog_index_content.
- Using the `tee` command with the `-overwrite` option to write the blog_index_content to ${www_root}/blog/index.html.
- Redirecting the output of `tee` to /dev/null to suppress any output.
This commit is contained in:
Stig-Ørjan Smelror 2024-02-12 22:24:13 +01:00
parent d8801d3b3f
commit 4c57f98146

9
qsgen2
View File

@ -917,13 +917,10 @@ function _blog_index() {
if (${debug}); then if (${debug}); then
_msg debug "_blog_index: Writing ${www_root}/blog/index.html" _msg debug "_blog_index: Writing ${www_root}/blog/index.html"
_msg debug "_blog_index: Content length of blog_index_content: ${#blog_index_content}" _msg debug "_blog_index: Content length of blog_index_content: ${#blog_index_content}"
_msg debug "_blog_index: Content of blog_index_content" #_msg debug "_blog_index: Content of blog_index_content"
_msg sub "${blog_index_content}" #_msg sub "${blog_index_content}"
fi fi
printf "%s" "$blog_index_content" > ${www_root}/blog/index.html || { echo "$blog_index_content" | tee -overwrite ${www_root}/blog/index.html > /dev/null
echo "Failed to write to ${www_root}/blog/index.html"
exit 1
}
_f_last_updated ${www_root}/blog/index.html _f_last_updated ${www_root}/blog/index.html
fi fi