diff options
| author | Philip Wittamore <philip@wittamore.com> | 2026-05-31 12:28:54 +0200 |
|---|---|---|
| committer | Philip Wittamore <philip@wittamore.com> | 2026-05-31 12:28:54 +0200 |
| commit | 77b8914d9f233321430f9a9a9947c52de9239a72 (patch) | |
| tree | 06c62d7db00b0d6ec8ecc1a223ed30e9d4fa985e /blogsitemap | |
update
Diffstat (limited to 'blogsitemap')
| -rwxr-xr-x | blogsitemap | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/blogsitemap b/blogsitemap new file mode 100755 index 0000000..8924287 --- /dev/null +++ b/blogsitemap @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +cd /home/philip/web + +# url configuration +URL="https://wittamore.fr/" + +# values: always hourly daily weekly monthly yearly never +FREQ="weekly" + +# begin new sitemap +exec 1> sitemap.xml + +# print head +echo '<?xml version="1.0" encoding="UTF-8"?>' +echo '<!-- generator="Milkys Sitemap Generator, https://github.com/mcmilk/sitemap-generator" -->' +echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' + +# print urls +IFS=$'\r\n' GLOBIGNORE='*' command eval "OPTIONS=($(cat $0.options))" +find . -type f "${OPTIONS[@]}" -printf "%TY-%Tm-%Td%p\n" | \ +while read -r line; do + DATE=${line:0:10} + FILE=${line:12} + echo "<url>" + echo " <loc>${URL}${FILE}</loc>" + echo " <lastmod>$DATE</lastmod>" + echo " <changefreq>$FREQ</changefreq>" + echo "</url>" +done + +# print foot +echo "</urlset>" |
