So I have an unusual workflow for my blog. There are a number of instructions on the web for deploying a jekyll based site template to a server from a git repo, and having the content auto built into the web root. Although I do store my jekyll blog in a git repo, and have my webhosts set up to receive files automatically from git, I do not do this.
The reasons I don’t do the sensible thing I describe above are that I simply don’t want much active code running on those servers beyond what is needed to do their main functions, so they don’t have ruby installed, and consequently couldn’t run jekyll. It doesn’t help that currently I am using a forked version of jekyll feed. So what I currently do is generate the site content locally and put that into a separate git repo. I then commit the changes, and raise a pull request on the Gitea server I set up. The issue here is with the tag cloud being on most of my blog posts and other assorted pages these pull requests are getting somewhat unwieldy. They can include changes to over 100 files. So I needed a way to split the tag cloud into it’s own file and include that in each page without doing any server side work. I tried using the object tag as that can apparently include external html content, but I couldn’t get it to look like I wanted. So I tried to use JavaScript, and it turns out it’s pretty easy. I stripped out the content of the template I was using to create the tag cloud, and created a template for the java script file. This then takes all the tags for my blog, and generates the links for the tag cloud and inserts them into what would otherwise be an empty div tag where the tag cloud used to be. It has decreased the time it takes Jekyll to generate my site considerably, and also reduced the number of files modified with each new blog post. So I’m counting this one as a success.