aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rwxr-xr-xsitemap.sh19
2 files changed, 14 insertions, 13 deletions
diff --git a/README.md b/README.md
index d297974..38fa28b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,5 @@
-# Sitemap Generator via bash
+# Bash-implementation for sitemap.xml
-Will generate a sitemap.xml file for the current directory and all it's subdirectires.
+The options of find are located in _sitemap.sh.options_
-The options of find are located in _sitemap.sh.options_ - there you can deselect file types or directories.
-
-/TR 2017-02-04
+Originally made by https://github.com/mcmilk/sitemap-generator
diff --git a/sitemap.sh b/sitemap.sh
index ab73965..5d0a42e 100755
--- a/sitemap.sh
+++ b/sitemap.sh
@@ -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