swx_sitemap 804 Bytes
Newer Older
prx's avatar
initial  
prx committed
1 2 3 4
#!/bin/sh
# création d'un sitemap xml.
# usage : swx_sitemap /dossier/contenant/le/site > sitemap.xml

prx's avatar
prx committed
5 6 7 8 9
. $PWD/swx.conf
. $PWD/swx.functions
setdirs "${1}"
updateordie

prx's avatar
initial  
prx committed
10 11 12 13 14 15 16 17 18 19 20
DIR="$1"
LASTMOD=$(date +%Y-%m-%d)



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>"
prx's avatar
prx committed
21 22
echo "<loc>${PROTOCOL}${HOSTNAME}</loc>"
echo "<lastmod>${LASTMOD}</lastmod>"
prx's avatar
initial  
prx committed
23 24
echo "</url>"

prx's avatar
prx committed
25
find "${DIR}" -name "*.html" | sed -e "s,${DIR},${PROTOCOL}${HOSTNAME}/,g" | awk {'print "<url>\n <loc>"$1"</loc>\n</url>"'}
prx's avatar
initial  
prx committed
26 27 28 29

echo "</urlset>"

exit 0