summaryrefslogtreecommitdiff
path: root/sitemap.sh
diff options
context:
space:
mode:
authoreudoxia <uplink@distress.network>2020-12-01 16:09:46 -0500
committereudoxia <uplink@distress.network>2020-12-01 16:09:46 -0500
commit15c26a6b26b5153023e3e4077f98b80cbb95b634 (patch)
tree838b41ce4e706334ba134f110b5b1fcc4c32db95 /sitemap.sh
parent7727bdb0a4200263c9fed7480df57a8cf06a178b (diff)
URL encoding now uses its own C program; removed Python dependency
Diffstat (limited to 'sitemap.sh')
-rwxr-xr-xsitemap.sh20
1 files changed, 2 insertions, 18 deletions
diff --git a/sitemap.sh b/sitemap.sh
index c6cfc38..d7c7b37 100755
--- a/sitemap.sh
+++ b/sitemap.sh
@@ -19,23 +19,7 @@ set -e
# along with this program. If not, see <http://www.gnu.org/licenses/>.
urlencode() (
- # urlencode <string>
-
- old_lc_collate=$LC_COLLATE
- LC_COLLATE=C
-
- length="${#1}"
- i=1
- while [ $i -le $length ] ; do
- c=$(expr substr "$1" $i 1) ;
- case $c in
- ([a-zA-Z0-9./~_-]) printf "$c" ;;
- (*) printf '%%%02X' "'$c" ;;
- esac ;
- true $((i=i+1)) ;
- done
-
- LC_COLLATE=$old_lc_collate
+ ./urlencode | sed 's;%2F;/;g'
)
echo '<?xml version="1.0" encoding="UTF-8"?>
@@ -46,7 +30,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' > $2
echo "$(find -L $1 -type d | sort | sed -e 's;^\./;;' -e '\;/\(.git\|css\|error\|favicon\|fonts\|js\|media\);d' -e 's;$;/;')" | \
while IFS='' read -r data ; do
DATE=$(grep "last-modified" ${data}/index.html | cut -f 4 -d \" | sed 's/ /T/' ) ;
- urlencode "$data" | sed -e 's;^;<url><loc>https://;' -e "s;$;</loc><lastmod>${DATE}</lastmod></url>;" ;
+ echo "$data" | urlencode | sed -e 's;^;<url><loc>https://;' -e "s;$;</loc><lastmod>${DATE}</lastmod></url>;" ;
printf "\n" ;
done >> $2