diff options
| author | Tino Reichardt | 2017-01-06 15:12:12 +0100 |
|---|---|---|
| committer | Tino Reichardt | 2017-01-06 15:12:12 +0100 |
| commit | e69ddea011669a43c3f7d0cb712f88cff54b290b (patch) | |
| tree | a6485bd514d054300de4a883fabe4940b0ae6b24 | |
| parent | 39b8cc33ecec2bf4f6ab725a5ab758b441d2f0e2 (diff) | |
| download | emil-sitemap-generator-e69ddea011669a43c3f7d0cb712f88cff54b290b.tar.xz emil-sitemap-generator-e69ddea011669a43c3f7d0cb712f88cff54b290b.tar.zst | |
Added the Script.
| -rwxr-xr-x | sitemap.sh | 30 | ||||
| -rw-r--r-- | sitemap.sh.options | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sitemap.sh b/sitemap.sh new file mode 100755 index 0000000..2782b40 --- /dev/null +++ b/sitemap.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# url configuration +URL="https://mcmilk.de/" + +# 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 %TH:%TM %p\n" | \ +while read -r line; do + # TIME is ignored... + DATE=${line:0:10} + TIME=${line:11:5} + FILE=${line:19} + echo "<url>" + echo " <loc>${URL}${FILE}</loc>" + echo " <lastmod>${DATE}</lastmod>" + echo " <changefreq>weekly</changefreq>" + echo "</url>" +done + +# print foot +echo "</urlset>" diff --git a/sitemap.sh.options b/sitemap.sh.options new file mode 100644 index 0000000..88e9176 --- /dev/null +++ b/sitemap.sh.options @@ -0,0 +1,10 @@ +-prune +! -iname robots.txt +! -iname sitemap.\* +! -iname .\* +! -path ./css/\* +! -path ./js/\* +! -path ./img/\* +! -path ./tmp/\* +! -path ./fonts/\* +! -path ./stats/\* |
