Skip to content

Instantly share code, notes, and snippets.

@txthinking
Last active March 7, 2022 03:24
Show Gist options
  • Save txthinking/44b0b133a27269c183cb10fd866d949b to your computer and use it in GitHub Desktop.
Save txthinking/44b0b133a27269c183cb10fd866d949b to your computer and use it in GitHub Desktop.
sitemap
#!/bin/bash
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > sitemap.xml
echo "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">" >> sitemap.xml
for l in `ls -l --time-style '+%Y-%m-%dT%H:%M:%SZ' ./articles | grep -P '\.article' | awk '{print $6";"$7}'`
do
t=`echo $l | cut -d\; -f1`
f=`echo $l | cut -d\; -f2`
echo "<url>" >> sitemap.xml
echo "<loc>https://talks.txthinking.com/articles/$f</loc>" >> sitemap.xml
echo "<lastmod>$t</lastmod>" >> sitemap.xml
echo "</url>" >> sitemap.xml
done
for l in `ls -l --time-style '+%Y-%m-%dT%H:%M:%SZ' ./slides | grep -P '\.slide' | awk '{print $6";"$7}'`
do
t=`echo $l | cut -d\; -f1`
f=`echo $l | cut -d\; -f2`
echo "<url>" >> sitemap.xml
echo "<loc>https://talks.txthinking.com/slides/$f</loc>" >> sitemap.xml
echo "<lastmod>$t</lastmod>" >> sitemap.xml
echo "</url>" >> sitemap.xml
done
for l in `ls -l --time-style '+%Y-%m-%dT%H:%M:%SZ' ./ | grep -P '\.html' | awk '{print $6";"$7}'`
do
t=`echo $l | cut -d\; -f1`
f=`echo $l | cut -d\; -f2`
echo "<url>" >> sitemap.xml
echo "<loc>https://talks.txthinking.com/$f</loc>" >> sitemap.xml
echo "<lastmod>$t</lastmod>" >> sitemap.xml
echo "</url>" >> sitemap.xml
done
echo "</urlset>" >> sitemap.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment