2023-02-10 14:02:43 -05:00
|
|
|
#!/bin/bash
|
|
|
|
# gensimap.sh: Generate a sitemap for my website.
|
|
|
|
# v2.0p1
|
2023-02-19 09:53:44 -05:00
|
|
|
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
2023-02-08 12:17:45 -05:00
|
|
|
function r { echo $@ >> out/sitemap.xml; }
|
2023-02-19 09:53:44 -05:00
|
|
|
inf "Generating Sitemap..."
|
|
|
|
if test -f out/sitemap.xml; then
|
|
|
|
inf "Overwriting current sitemap..."
|
|
|
|
sed -i d sitemap.xml
|
|
|
|
fi
|
2023-02-01 11:59:44 -05:00
|
|
|
r '<?xml version="1.0" encoding="UTF-8"?>'
|
2023-02-01 16:08:28 -05:00
|
|
|
r '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
|
2023-02-08 12:17:45 -05:00
|
|
|
for i in `find in -type f -name '*.html'`; do
|
2023-02-01 16:08:28 -05:00
|
|
|
r "<url>"
|
|
|
|
r "<loc>https://atlas48.neocities.org/$i</loc>"
|
|
|
|
r "<lastmod>$(date +"%Y-%M-%d" -r $i)</lastmod>"
|
2023-02-01 11:59:44 -05:00
|
|
|
r "</url>"
|
|
|
|
done
|
|
|
|
r "</urlset>"
|