Spaces and tabs
This commit is contained in:
parent
5d399d716f
commit
166157fc77
76
qsgen2
76
qsgen2
@ -796,12 +796,12 @@ function _blogs() {
|
|||||||
export new_updated_blogs=false
|
export new_updated_blogs=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${new_updated_blogs} == "true" ]]; then
|
if [[ ${new_updated_blogs} == "true" ]]; then
|
||||||
if (${debug}) _msg sub "* _blogs: Running _blog_idx_for_index"
|
if (${debug}) _msg sub "* _blogs: Running _blog_idx_for_index"
|
||||||
_blog_idx_for_index
|
_blog_idx_for_index
|
||||||
if (${debug}) _msg sub "* _blogs: Running _blog_index"
|
if (${debug}) _msg sub "* _blogs: Running _blog_index"
|
||||||
_blog_index
|
_blog_index
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,47 +939,47 @@ function _sitemap() {
|
|||||||
local debug=false
|
local debug=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file.
|
# Check if sitemap is set to true and if there are updated Blogs or Pages before updating the sitemap.xml file.
|
||||||
if [[ ${sitemap} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] ); then
|
if [[ ${sitemap} == "true" ]] && ( [[ ${new_updated_blogs} == "true" ]] || [[ ${new_updated_pages} == "true" ]] ); then
|
||||||
|
|
||||||
_msg main "Generating Sitemap"
|
_msg main "Generating Sitemap"
|
||||||
|
|
||||||
local sitemap_file="${www_root}/sitemap.xml"
|
local sitemap_file="${www_root}/sitemap.xml"
|
||||||
|
|
||||||
# Find all HTML files and store them in an array
|
# 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=("${(@f)$(find "${www_root}" -type f -name "*.html")}")
|
||||||
|
|
||||||
# Start of the XML file
|
# Start of the XML file
|
||||||
echo '<?xml version="1.0" encoding="UTF-8"?>' > ${sitemap_file}
|
echo '<?xml version="1.0" encoding="UTF-8"?>' > ${sitemap_file}
|
||||||
echo "<!-- Sitemap generated by ${QSGEN} ${VERSION} - https://github.com/kekePower/qsgen2 -->" >> ${sitemap_file}
|
echo "<!-- Sitemap generated by ${QSGEN} ${VERSION} - https://github.com/kekePower/qsgen2 -->" >> ${sitemap_file}
|
||||||
echo "<?xml-stylesheet type=\"text/xsl\" href=\"${site_url}/css/default-sitemap.xsl?sitemap=page\"?>" >> ${sitemap_file}
|
echo "<?xml-stylesheet type=\"text/xsl\" href=\"${site_url}/css/default-sitemap.xsl?sitemap=page\"?>" >> ${sitemap_file}
|
||||||
echo '<urlset' >> ${sitemap_file}
|
echo '<urlset' >> ${sitemap_file}
|
||||||
echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_file}
|
echo ' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' >> ${sitemap_file}
|
||||||
echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_file}
|
echo ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' >> ${sitemap_file}
|
||||||
echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_file}
|
echo ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"' >> ${sitemap_file}
|
||||||
echo '>' >> ${sitemap_file}
|
echo '>' >> ${sitemap_file}
|
||||||
|
|
||||||
# Add each URL to the sitemap
|
# Add each URL to the sitemap
|
||||||
for file in "${html_files[@]}"
|
for file in "${html_files[@]}"
|
||||||
do
|
do
|
||||||
# Remove www_root from the path and prepend site_url
|
# Remove www_root from the path and prepend site_url
|
||||||
local url="${site_url}${file#$www_root}"
|
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/\..*$//')
|
local lastmod=$(stat -c %y "${file}" 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | sed 's/\..*$//')
|
||||||
|
|
||||||
echo " <url>" >> ${sitemap_file}
|
echo " <url>" >> ${sitemap_file}
|
||||||
echo " <loc>${url}</loc>" >> ${sitemap_file}
|
echo " <loc>${url}</loc>" >> ${sitemap_file}
|
||||||
echo " <lastmod><![CDATA[${lastmod}+01:00]]></lastmod>" >> "${sitemap_file}"
|
echo " <lastmod><![CDATA[${lastmod}+01:00]]></lastmod>" >> "${sitemap_file}"
|
||||||
echo " <changefreq><![CDATA[always]]></changefreq>" >> ${sitemap_file}
|
echo " <changefreq><![CDATA[always]]></changefreq>" >> ${sitemap_file}
|
||||||
echo " <priority><![CDATA[1]]></priority>" >> ${sitemap_file}
|
echo " <priority><![CDATA[1]]></priority>" >> ${sitemap_file}
|
||||||
echo " </url>" >> ${sitemap_file}
|
echo " </url>" >> ${sitemap_file}
|
||||||
done
|
done
|
||||||
|
|
||||||
# End of the XML file
|
# End of the XML file
|
||||||
echo '</urlset>' >> "${sitemap_file}"
|
echo '</urlset>' >> "${sitemap_file}"
|
||||||
|
|
||||||
if (${debug}); then _msg debug "Sitemap generated at ${sitemap_file}"; fi
|
if (${debug}); then _msg debug "Sitemap generated at ${sitemap_file}"; fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user