diff --git a/qsgen2 b/qsgen2
index b288ad2..539b139 100755
--- a/qsgen2
+++ b/qsgen2
@@ -927,20 +927,24 @@ function _sitemap() {
# Find all HTML files and store them in an array
# local -a html_files=("${(@f)$(find "${www_root}" -type f -name "*.html")}")
local -a html_files=(${www_root}/**/[a-z]*.html(.))
- local -a blog_files=(${html_files[@]:#*blog*})
- local -a page_files=("${(@)html_files[@]}" | grep -v blog)
+ local -a blog_files=(${html_files[@]:#*blog/2*})
+ local -a page_files=()
+ for file in "${html_files[@]}"; do
+ [[ $file != *blog* ]] && blog_files+=("$file")
+ done
+
local -a xml_files=(${www_root}/[a-z]*.xml(.))
xml_files=( "${(@)xml_files[@]}" | grep -v "sitemap.xml" )
# Start of the XML file for BLOGS
- echo '' > ${b_file}
- echo "" >> ${b_file}
- echo "" >> ${b_file}
- echo '> ${b_file}
- echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${b_file}
- echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${b_file}
- echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${b_file}
- echo '>' >> ${b_file}
+ echo '' > ${sitemap_blog}
+ echo "" >> ${sitemap_blog}
+ echo "" >> ${sitemap_blog}
+ echo '> ${sitemap_blog}
+ echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_blog}
+ echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_blog}
+ echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_blog}
+ echo '>' >> ${sitemap_blog}
# Add each URL to the sitemap
for file in "${blog_files[@]}"
@@ -949,27 +953,27 @@ function _sitemap() {
local url="${site_url}${file#$www_root}"
local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//')
- echo " " >> ${b_file}
- echo " ${url}" >> ${b_file}
- echo " " >> ${b_file}
- echo " " >> ${b_file}
- echo " " >> ${b_file}
- echo " " >> ${b_file}
+ echo " " >> ${sitemap_blog}
+ echo " ${url}" >> ${sitemap_blog}
+ echo " " >> ${sitemap_blog}
+ echo " " >> ${sitemap_blog}
+ echo " " >> ${sitemap_blog}
+ echo " " >> ${sitemap_blog}
done
# End of the XML file
- echo '' >> "${b_file}"
+ echo '' >> "${sitemap_blog}"
_msg std " - ${b_file}"
# Start of the XML file for PAGES
- echo '' > ${p_file}
- echo "" >> ${p_file}
- echo "" >> ${p_file}
- echo '> ${p_file}
- echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${p_file}
- echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${p_file}
- echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${p_file}
- echo '>' >> ${p_file}
+ echo '' > ${sitemap_page}
+ echo "" >> ${sitemap_page}
+ echo "" >> ${sitemap_page}
+ echo '> ${sitemap_page}
+ echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_page}
+ echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_page}
+ echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_page}
+ echo '>' >> ${sitemap_page}
# Add each URL to the sitemap
for file in "${page_files[@]}"
@@ -978,16 +982,16 @@ function _sitemap() {
local url="${site_url}${file#$www_root}"
local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//')
- echo " " >> ${p_file}
- echo " ${url}" >> ${p_file}
- echo " " >> ${p_file}
- echo " " >> ${p_file}
- echo " " >> ${p_file}
- echo " " >> ${p_file}
+ echo " " >> ${sitemap_page}
+ echo " ${url}" >> ${sitemap_page}
+ echo " " >> ${sitemap_page}
+ echo " " >> ${sitemap_page}
+ echo " " >> ${sitemap_page}
+ echo " " >> ${sitemap_page}
done
# End of the XML file
- echo '' >> "${p_file}"
+ echo '' >> "${sitemap_page}"
_msg std " - ${p_file}"
# Start of the XML file