pmd/.travis/sitemap_generator.sh

57 lines
1.2 KiB
Bash
Raw Normal View History

2018-05-18 01:15:25 +02:00
#!/bin/bash
# Sitemap generator
# Assumes we have the latest version of the site under "latest" and "pmd-${RELEASE_VERSION}"
2018-05-18 01:25:40 +02:00
# https://www.sitemaps.org/protocol.html
2018-05-18 01:15:25 +02:00
WEBSITE_PREFIX="https://pmd.github.io/"
DOC_PREFIX="latest/" # "pmd-${RELEASE_VERSION}/"
2018-05-18 01:15:25 +02:00
DATE=`date +%Y-%m-%d`
2018-05-18 01:41:41 +02:00
# Priority is relative to the website, can be chosen in {0.1, 0.2, ..., 1}
# Default priority is 0.5
LATEST_PRIORITY=0.8
2018-05-18 01:15:25 +02:00
# Writes to standard output
2018-05-18 01:15:25 +02:00
cat << HEADER_END
2018-05-18 01:15:25 +02:00
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2018-05-18 01:25:40 +02:00
<url>
<loc>${WEBSITE_PREFIX}index.html</loc>
<priority>1</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
<url>
<loc>${WEBSITE_PREFIX}${DOC_PREFIX}index.html</loc>
<priority>0.9</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
2018-05-18 01:15:25 +02:00
HEADER_END
2018-05-18 01:25:40 +02:00
for page in ${DOC_PREFIX}pmd_*.html
2018-05-18 01:15:25 +02:00
do
cat << ENTRY_END
2018-05-18 01:25:40 +02:00
<url>
<loc>${WEBSITE_PREFIX}$page</loc>
<priority>$LATEST_PRIORITY</priority>
<changefreq>monthly</changefreq>
<lastmod>$DATE</lastmod>
</url>
2018-05-18 01:18:07 +02:00
ENTRY_END
2018-05-18 01:15:25 +02:00
done
echo "</urlset>"
2018-05-18 01:15:25 +02:00