diff --git a/qsgen2 b/qsgen2 index 33b5381..cc0911d 100755 --- a/qsgen2 +++ b/qsgen2 @@ -436,10 +436,18 @@ function _pages() { local page_content=$(echo "$page_content" | ${engine}) fi - # Insert page_content into pages_tpl by replacing the BODY tag present there - if (${debug}) _msg debug "_pages: Replacing BODY with page_content in pages_tpl using Perl" - # Use Perl for multi-line and special character handling - local pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") ) + if [[ ${new_updated_blogs} == "true" ]] && [[ ${blog_in_index} == "true" ]]; then + if [[ ${pages_in_array} == "index.${file_ext}" ]]; then + # Insert page_content into pages_tpl by replacing the BODY tag present there + if (${debug}) _msg debug "_pages: 1. Replacing BODY with page_content in pages_tpl using Perl" + # Use Perl for multi-line and special character handling + local pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") ) + fi + else + if (${debug}) _msg debug "_pages: 2. Replacing BODY with page_content in pages_tpl using Perl" + # Use Perl for multi-line and special character handling + local pages_tpl=$( awk -v new_body="$page_content" '{sub(/BODY/, new_body)} 1' <(echo "${pages_tpl}") ) + fi # Replace every #pagetitle in pages_tpl if (${debug}) _msg debug "_pages: Replacing #pagetitle in pages_tpl" @@ -681,7 +689,7 @@ function _add_blog_list_to_index() { # Let's find the file 'index.tpl' and add the blog if blog_in_index is true if [[ ${new_updated_blogs} == "true" ]] && [[ ${blog_in_index} == "true" ]]; then - if (${debug}) _msg debug "_pages: Inserting blog list to index.html" + if (${debug}) _msg debug "_add_blog_list_to_index: Inserting blog list to index.html" local blog_index_list=$(<${project_dir}/blog/index.tmp.html) local site_index_file=$(<${www_root}/index.html) echo "${site_index_file}" | awk -v new_body="${blog_index_list}" '{sub(/BLOGINDEX/, new_body)} 1' > "${www_root}/index.html"