paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1d1743a822e6f0abe5cdedfea34bbdeaeb255ab3
parent ceb47fe5db2a5b2d65979bb0d682f89603d02937
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Mon, 30 Dec 2019 13:36:37 -0500

Add sitemap updating to publish script

I forgot about the sitemap in the initial automation. Add functionality
to update the sitemap when publishing a new page.

Further code cleanups as well.

Diffstat:
Mpublic/sitemap.xml | 104++++++++++++++++++++-----------------------------------------------------------
Mpublish | 19+++++++++++++------
2 files changed, 39 insertions(+), 84 deletions(-)

diff --git a/public/sitemap.xml b/public/sitemap.xml @@ -1,81 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> - <url> - <loc>https://www.paritybit.ca</loc> - </url> - <url> - <loc>https://www.paritybit.ca/home</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/automating-publishing</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/arguing-effectively</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/difficulty-of-privacy-education</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/qutebrowser-to-firefox</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/china</loc> - </url> - <url> - <loc>https://www.paritybit.ca/blog/other-blogs</loc> - </url> - <url> - <loc>https://www.paritybit.ca/projects</loc> - </url> - <url> - <loc>https://www.paritybit.ca/projects/usrmnt</loc> - </url> - <url> - <loc>https://www.paritybit.ca/projects/morrowind-character-roller</loc> - </url> - <url> - <loc>https://www.paritybit.ca/projects/dnd/roll</loc> - </url> - <url> - <loc>https://www.paritybit.ca/projects/dnd/initiative</loc> - </url> - <url> - <loc>https://www.paritybit.ca/guides</loc> - </url> - <url> - <loc>https://www.paritybit.ca/guides/debian-with-btrfs</loc> - </url> - <url> - <loc>https://www.paritybit.ca/guides/using-rm-with-trash</loc> - </url> - <url> - <loc>https://www.paritybit.ca/about-me</loc> - </url> - <url> - <loc>https://www.paritybit.ca/now</loc> - </url> - <url> - <loc>https://www.paritybit.ca/contact</loc> - </url> - <url> - <loc>https://www.paritybit.ca/toolset</loc> - </url> - <url> - <loc>https://www.paritybit.ca/about-site</loc> - </url> - <url> - <loc>https://www.paritybit.ca/feeds/sitewide-feed.xml</loc> - </url> - <url> - <loc>https://www.paritybit.ca/feeds/blog-feed.xml</loc> - </url> - <url> - <loc>https://www.paritybit.ca/feeds/projects-feed.xml</loc> - </url> - <url> - <loc>https://www.paritybit.ca/feeds/guides-feed.xml</loc> - </url> + <url><loc>https://www.paritybit.ca</loc></url> + <url><loc>https://www.paritybit.ca/home</loc></url> + <url><loc>https://www.paritybit.ca/blog</loc></url> + <url><loc>https://www.paritybit.ca/blog/automating-publishing</loc></url> + <url><loc>https://www.paritybit.ca/blog/arguing-effectively</loc></url> + <url><loc>https://www.paritybit.ca/blog/difficulty-of-privacy-education</loc></url> + <url><loc>https://www.paritybit.ca/blog/qutebrowser-to-firefox</loc></url> + <url><loc>https://www.paritybit.ca/blog/china</loc></url> + <url><loc>https://www.paritybit.ca/blog/other-blogs</loc></url> + <url><loc>https://www.paritybit.ca/projects</loc></url> + <url><loc>https://www.paritybit.ca/projects/usrmnt</loc></url> + <url><loc>https://www.paritybit.ca/projects/morrowind-character-roller</loc></url> + <url><loc>https://www.paritybit.ca/projects/dnd/roll</loc></url> + <url><loc>https://www.paritybit.ca/projects/dnd/initiative</loc></url> + <url><loc>https://www.paritybit.ca/guides</loc></url> + <url><loc>https://www.paritybit.ca/guides/debian-with-btrfs</loc></url> + <url><loc>https://www.paritybit.ca/guides/using-rm-with-trash</loc></url> + <url><loc>https://www.paritybit.ca/about-me</loc></url> + <url><loc>https://www.paritybit.ca/now</loc></url> + <url><loc>https://www.paritybit.ca/contact</loc></url> + <url><loc>https://www.paritybit.ca/toolset</loc></url> + <url><loc>https://www.paritybit.ca/about-site</loc></url> + <url><loc>https://www.paritybit.ca/feeds/sitewide-feed.xml</loc></url> + <url><loc>https://www.paritybit.ca/feeds/blog-feed.xml</loc></url> + <url><loc>https://www.paritybit.ca/feeds/projects-feed.xml</loc></url> + <url><loc>https://www.paritybit.ca/feeds/guides-feed.xml</loc></url> </urlset> diff --git a/publish b/publish @@ -133,21 +133,19 @@ entry="${entry} entry="${entry} <pubDate>$date</pubDate>" -# Get content of \<page\>-content.html and make description if [ $publishBlog ]; then + # Get content of \<page\>-content.html and make description pageContent=$(cat build/blog/"$filename"-content.html) entry="${entry} <description><![CDATA[$pageContent]]></description>" -elif [ $publishProject ] || [ $publishGuide ]; then +else + # Otherwise get description from user echo "REPLACE THIS TEXT WITH A DESCRIPTION FOR THE PROJECT/GUIDE." \ > $descriptionFile /usr/bin/editor $descriptionFile description=$(cat $descriptionFile) entry="${entry} <description><![CDATA[$description]]></description>" -else - echo "Something went very wrong... (<description>)" - exit -1 fi # Close the entry @@ -175,10 +173,19 @@ tput setaf 2; tput bold echo "[DONE]" tput sgr0 +# Update the sitemap +printf " Updating sitemap.xml " +sed -i "/$baseURL/a \<url\>\<loc\>$baseURL/$filename\<\/loc\>\<\/url\>" + +tput setaf 2; tput bold +echo "[DONE]" +tput sgr0 + # Upload the new feeds plus the new article and updated pages to the website printf " Uploading pages and feeds... " -cd public && rsync -rR html/home.html feeds/sitewide-feed.xml $feed $categoryPage $article $destination && cd .. +cd public && rsync -rR html/home.html sitemap.xml feeds/sitewide-feed.xml \ +"$feed" "$categoryPage" "$article" "$destination" && cd .. tput setaf 2; tput bold echo "[DONE]"