1234567891011121314151617181920212223242526272829303132 |
- #!/bin/sh
- # création d'un sitemap xml.
- # usage : swx_sitemap /dossier/contenant/le/site > sitemap.xml
- DIR="$1"
- LASTMOD=$(date +%Y-%m-%d)
- # Load config file
- if [ ! -f $PWD/swx.conf ]; then
- echo "Cannot find swx.conf in current directory"
- exit 1
- fi
- . $PWD/swx.conf
- echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"
- echo " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- echo " xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 "
- echo " http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">"
- echo "<url>"
- echo "<loc>$HOSTNAME</loc>"
- echo "<lastmod>$LASTMOD</lastmod>"
- echo "</url>"
- find "$DIR" -name *.html | sed -e "s,$DIR,$HOSTNAME/,g" | awk {'print "<url>\n <loc>"$1"</loc>\n</url>"'}
- echo "</urlset>"
- exit 0
|