paritybit.ca

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

commit 0f1dcee7ec8a55804a8bcd6c0e550beae71af13e
parent d38abf9d2f2ed493a38ed908a534946a25711bc4
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Thu, 11 Jun 2020 17:08:40 -0400

Publish new blog post

Diffstat:
Mpages/blog.md | 1+
Apages/blog/improving-my-blog-post-publishing-script.md | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpages/home.md | 4++--
Mpublic/feeds/sitewide-feed.xml | 17+++++++++++++++++
Mpublic/sitemap.xml | 1+
5 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/pages/blog.md b/pages/blog.md @@ -20,6 +20,7 @@ href="https://social.paritybit.ca/@jbauer">Mastodon</a>. ### 2020 <ul> + <li>2020-06-11 <a href="blog/improving-my-blog-post-publishing-script">Improving My Blog Post Publishing Script</a></li> <li>2020-06-11 <a href="blog/trying-out-dwm">Trying Out dwm</a></li> <li>2020-06-09 <a href="blog/setting-up-a-status-page">Setting Up a Status Page</a></li> <li>2020-06-08 <a href="blog/scripting-my-way-to-success">Scripting My Way to Success</a></li> diff --git a/pages/blog/improving-my-blog-post-publishing-script.md b/pages/blog/improving-my-blog-post-publishing-script.md @@ -0,0 +1,63 @@ +## Improving My Blog Post Publishing Script + +[//]: # "Like I previously did for my website compilation script, today I rewrote the script I use to publish posts to my website. It's been made more portable, more maintainable, and cleaner. It also led to improvements in my compilation script." + +[//]: # "main.min.css" + +[//]: # + +<div class="byline"> +<b>Written By:</b> Jake Bauer | + <b>Posted:</b> 2020-06-11 | + <b>Last Updated:</b> 2020-06-11 +</div> + +Like I [previously did to my website compilation +script](https://www.paritybit.ca/blog/rewriting-my-static-site-generator), today +I rewrote the script I use to publish posts to my website and syndicate those +posts to Mastodon. It was about time since that script was a long list of +commands with no functions, few clear variables, and written in Bash instead of +POSIX shell code. + +Thanks to the work I did for my compilation script, I could copy much of the +structure and some functions over to the new publish script. The lessons I +learned in making the compilation script portable also meant that I already had +the skills and knowledge necessary to make the publish script portable with +little effort. I've tested the publish script on FreeBSD as well as Linux and it +seems to work without any issues. For the most part, since I only wanted to +clean up and organize the script and didn't want to change its behaviour, I +could just copy and paste most of what I already had in the script into +functions with small tweaks here and there. + +The refactored version of the script weighs in at 7070 bytes, 267 lines, and 183 +source lines of code as of the time of writing. This is in comparison to the +previous iteration of the script which weighed in at 4543 bytes, 181 lines, and +106 source lines of code. The new script is definitely larger, but also way +more maintainable and portable. + +As a consequence of this rewrite, I also noticed some undesirable behaviour: +since `publish` calls `compile`, if auto-uploading was enabled in `compile`, the +markdown files changed by `publish` would be uploaded twice. To solve this, and +to make `compile` easier to use in general, I added argument parsing and a few +command line options to the `compile` script. Now that script includes command +line switches to print brief help text and toggle strict markdown compilation +and auto uploading. + +Another addition I made was to include the text of the `<meta name=description>` +tag in my Mastodon status updates. Before I used to just post "New Blog Post:" +with the title of the post and a URL, but now a quick summary of the post will +also be included in the status updates which provides extra context and makes it +easier for people to decide if they care to read the post or not. + +You can [view the updated version of the +script](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/publish) in the +repository for this website. It's portable between operating systems but, unlike +`compile`, it wasn't really written for other people to use for their sites. +Therefore, if you wish to adapt it for your own site, there are a few changes +you'll have to make and you should go through the entire file and make sure +things like hard-coded paths and such are set for your environment. + +_This is my forty-second post for the +[#100DaysToOffload](https://social.paritybit.ca/tags/100DaysToOffload) +challenge. You can learn more about this challenge over at +[https://100daystooffload.com](https://100daystooffload.com)._ diff --git a/pages/home.md b/pages/home.md @@ -20,6 +20,8 @@ extent)! Access through `gopher://paritybit.ca` or `gemini://paritybit.ca`. src="/img/feed-icon.png" width="15" height="15" alt="Click for RSS Feed"/> </a> </div> +2020-06-11 <a class="feed-item" href="blog/improving-my-blog-post-publishing-script">Improving My Blog Post Publishing Script</a> + 2020-06-11 <a class="feed-item" href="blog/trying-out-dwm">Trying Out dwm</a> 2020-06-09 <a class="feed-item" href="blog/setting-up-a-status-page">Setting Up a Status Page</a> @@ -37,8 +39,6 @@ extent)! Access through `gopher://paritybit.ca` or `gemini://paritybit.ca`. 2020-05-31 <a class="feed-item" href="blog/it-doesnt-have-to-be-perfect">It Doesn't Have to Be Perfect</a> 2020-05-29 <a class="feed-item" href="blog/book-review-the-mediocre-programmer">Book Review: The Mediocre Programmer</a> - -2020-05-28 <a class="feed-item" href="blog/a-quick-rant-about-web-font-sizes">A Quick Rant About Web Font Sizes</a> ### What is a Parity Bit? It is a bit (in the 1's and 0's sense) used in checking for errors in digital diff --git a/public/feeds/sitewide-feed.xml b/public/feeds/sitewide-feed.xml @@ -7,6 +7,23 @@ <description>The feed that covers all notable additions, updates, announcements, and other changes for the entire paritybit.ca website.</description> <item> + <title>Improving My Blog Post Publishing Script</title> + <link>https://www.paritybit.ca/blog/improving-my-blog-post-publishing-script</link> + <guid>https://www.paritybit.ca/blog/improving-my-blog-post-publishing-script</guid> + <pubDate>Thu, 11 Jun 2020 17:06:52 -0400</pubDate> + <description><![CDATA[<h2 id="improving-my-blog-post-publishing-script">Improving My Blog Post Publishing Script</h2> +<div class="byline"> +<p><b>Written By:</b> Jake Bauer | <b>Posted:</b> 2020-06-11 | <b>Last Updated:</b> 2020-06-11</p> +</div> +<p>Like I <a href="https://www.paritybit.ca/blog/rewriting-my-static-site-generator">previously did to my website compilation script</a>, today I rewrote the script I use to publish posts to my website and syndicate those posts to Mastodon. It was about time since that script was a long list of commands with no functions, few clear variables, and written in Bash instead of POSIX shell code.</p> +<p>Thanks to the work I did for my compilation script, I could copy much of the structure and some functions over to the new publish script. The lessons I learned in making the compilation script portable also meant that I already had the skills and knowledge necessary to make the publish script portable with little effort. I’ve tested the publish script on FreeBSD as well as Linux and it seems to work without any issues. For the most part, since I only wanted to clean up and organize the script and didn’t want to change its behaviour, I could just copy and paste most of what I already had in the script into functions with small tweaks here and there.</p> +<p>The refactored version of the script weighs in at 7070 bytes, 267 lines, and 183 source lines of code as of the time of writing. This is in comparison to the previous iteration of the script which weighed in at 4543 bytes, 181 lines, and 106 source lines of code. The new script is definitely larger, but also way more maintainable and portable.</p> +<p>As a consequence of this rewrite, I also noticed some undesirable behaviour: since <code>publish</code> calls <code>compile</code>, if auto-uploading was enabled in <code>compile</code>, the markdown files changed by <code>publish</code> would be uploaded twice. To solve this, and to make <code>compile</code> easier to use in general, I added argument parsing and a few command line options to the <code>compile</code> script. Now that script includes command line switches to print brief help text and toggle strict markdown compilation and auto uploading.</p> +<p>Another addition I made was to include the text of the <code>&lt;meta name=description&gt;</code> tag in my Mastodon status updates. Before I used to just post “New Blog Post:” with the title of the post and a URL, but now a quick summary of the post will also be included in the status updates which provides extra context and makes it easier for people to decide if they care to read the post or not.</p> +<p>You can <a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/publish">view the updated version of the script</a> in the repository for this website. It’s portable between operating systems but, unlike <code>compile</code>, it wasn’t really written for other people to use for their sites. Therefore, if you wish to adapt it for your own site, there are a few changes you’ll have to make and you should go through the entire file and make sure things like hard-coded paths and such are set for your environment.</p> +<p><em>This is my forty-second post for the <a href="https://social.paritybit.ca/tags/100DaysToOffload">#100DaysToOffload</a> challenge. You can learn more about this challenge over at <a href="https://100daystooffload.com" class="uri">https://100daystooffload.com</a>.</em></p>]]></description> + </item> +<item> <title>Trying Out dwm</title> <link>https://www.paritybit.ca/blog/trying-out-dwm</link> <guid>https://www.paritybit.ca/blog/trying-out-dwm</guid> diff --git a/public/sitemap.xml b/public/sitemap.xml @@ -3,6 +3,7 @@ <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/improving-my-blog-post-publishing-script</loc></url> <url><loc>https://www.paritybit.ca/blog/trying-out-dwm</loc></url> <url><loc>https://www.paritybit.ca/blog/setting-up-a-status-page</loc></url> <url><loc>https://www.paritybit.ca/blog/scripting-my-way-to-success</loc></url>