diff options
| author | Emil Williams | 2025-05-29 15:25:01 -0600 |
|---|---|---|
| committer | Emil Williams | 2025-05-29 15:25:01 -0600 |
| commit | 53d60086d2c3c05c57a5ec0e156ce84976ae8b03 (patch) | |
| tree | f0d7180cfa07c29f4d3e8e098860d789b0bf955d /sitemap.sh | |
| parent | bdd871eacd9630d9ed80f53efb43b33259ee3f36 (diff) | |
| download | emil-sitemap-generator-53d60086d2c3c05c57a5ec0e156ce84976ae8b03.tar.xz emil-sitemap-generator-53d60086d2c3c05c57a5ec0e156ce84976ae8b03.tar.zst | |
variable inputs
Diffstat (limited to 'sitemap.sh')
| -rwxr-xr-x | sitemap.sh | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -1,17 +1,17 @@ #!/bin/bash -# url configuration -URL="https://$(hostname)/" +HOSTNAME=${HOSTNAME:-$(hostname)} +URL="https://$HOSTNAME/" # values: always hourly daily weekly monthly yearly never -FREQ="weekly" +FREQ=${FREQ:-"weekly"} -# begin new sitemap +generate(){ 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 '<!-- generator="https://git.xolatile.top/emil/sitemap-generator" -->' echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">' # print urls @@ -21,11 +21,14 @@ 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 "<loc>${URL}${FILE}</loc>" + echo "<lastmod>$DATE</lastmod>" + echo "<changefreq>$FREQ</changefreq>" echo "</url>" done # print foot echo "</urlset>" +} + +generate |
