Episode: 3659
Title: HPR3659: Developing an HPR static site generator
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3659/hpr3659.mp3
Transcribed: 2025-10-25 02:58:16

---

This is Hacker Public Radio Episode 3659 for Thursday the 11th of August 2022.
Today's show is entitled, Developing an HPR Static Site Generator.
It is hosted by Rosen, and is about 11 minutes long.
It carries a clean flag.
The summary is, Rosen describes his approach to developing the Static Site Generator for
HPR.
Hello, this is Rowan, and welcome to another episode of Hacker Public Radio.
In this episode, I will describe my ongoing attempt to develop a Static Site Generator
for the HPR website.
This was inspired by a post from Ken Fallon onto the mailing list, a source code for
the HPR website.
It does appear that there have been other talks through the years about developing the
site statically.
I think the first one I found also from Ken Fallon was a message with the subject static
site generators, not a flat file CMS.
This was back in 2019.
While I have read about various static site generators over the years, the only one I have
had any experience with was template toolkit, sometimes referred to as TT2, when helping
Ken Fallon and Dave Morris develop the free culture podcast webpage.
This is a tool Dave uses for various projects.
As they are the janitors for HPR, I figured a website generator based on TT2 would be
something relatively painless enough for them to use and update when needed.
The template toolkit is written in Pearl, which after, I guess, these many years and slightly
rose colored glasses, does bring back fond memories back in my early days of webmastering
and sitting with Unix Unleashed in my lap, learning about Pearl to rate CGI scripts to
process contact forms and the various interactive things we did back then with Pearl on your
websites.
It's been a while, but I do like Pearl.
You can whip up some fairly complex programs in a relatively short amount of time.
In the past, I've even done a prototype IVR interactive voice response system, something
for a phone system, basically using asterisks where you could call in and then dial in in
a number and an account number, and it would give you information on that account.
I used Pearl to do the look up and then interact with the text to speech synthesizer and
things, so that was pretty cool and relatively easy.
When Pearl has the comprehensive Pearl Archive Network C-PAN, which makes finding Pearl
modules very easy and relatively easy to install, I do have to admit there are a number of dependencies
in the code and some of them were easier to get to work.
I tried to do everything from a normal user account and some of the packages, you needed
to be rude to get it to install right, and then one package I even had to actually use
the distributions Pearl module, because I just couldn't get it to compile.
With Pearl packages, a lot of times they use C in the background for speed, so you do
need almost the full developer's tool suite, GCC and make it all that running on your
machine to be able to install a number of modules in Pearl.
There is a little bit of complexity that I had, I guess, forgotten about.
It's not quite as easy as some of the other ones are these days, but you can get there
and, like I said, Pearl C-PAN has modules for everything, so definitely worth looking
into and taking the time to get working.
That does take me to, where is the code?
The code is currently hosted at repo.andhonesthost.net forward slash r-h-o underscore n forward slash
hpr underscore generator.
You do need an account on repo.andhonesthost.net to be able to get to the code.
There's also Ken Fallon's fork on there, and now I think there's a couple other repositories
about with other related projects that you can find on the repo.
It is a get-t instance, which is very nice.
I'm enjoying get-t, I use it at work, so it's been nice using it elsewhere.
I do encourage anybody interested to help out.
I didn't realize you don't think, oh, it's not that big of a wigslite.
There's a lot of pages.
Not all of them are, you know, that have complicated some of them are very static, so to begin with,
so it's pretty easy to set up the page and just cut and paste from the source of your browser
into the template page and then you're done and off to the next page.
There are a number of those, and then I have been spending quite a lot of time figuring
out how to get the more dynamic stuff running.
I guess you could just write the templates, and their template toolkit does come with
a couple like tools that let you generate the pages running their commands, so you probably
could have just done a bunch of different templates to a degree, and then either write
a bash script or just run the various commands to get the various pages generated, but my
idea was to have a program, these called uniquely enough site-generator, and you basically
then give it a list of pages that you want to generate, and it will go through and do
that, or there's a special all page which will generate all the pages on the site.
Of course, as I went along that nice little paradigm ran into some snags because of course
well, then what if you only want to generate one of the episode pages, but the episode
pages uses the same template, so then I had to add a way to say like I want the episode
of episode 3367, so add a little complexity, but I think I've come up with a fairly nice
way to do that from the command line with some decent defaults.
So I do hope people give it a whirl and give me some feedback on that too, a feedback
or help with caretling, it's greatly appreciated some nights I'm here just going, oh well
this never end, but slowly but shortly.
I've also set up a test website that's available publicly called hpr.horning.us, and it will
now each night go through and do a pool from my repository and then regenerate the pages based
on what the latest changes to the code are, so I can then go through and test it on a machine
that's not got all the maybe some of the changes that I've made but haven't committed and stuff,
so it's a good way to see exactly how far I am as far as usable code for other people.
It does come to now the database, so my other goal for this was to be able to use the current
database schema, I know we've been talking about moving to from my SQL to SQL
light so that people could just get this database file and run it relatively easily compared to
having to set up like mySQL or Postgres or any other more traditional database system,
and to that, Ken did go through and he now is publishing each night a dump from the mySQL database.
Originally I had sort of gone through the schema and made up my own little test database and
filled it with some test data just so I could you know get the pages to generate using SQL light
and then eventually I figured well I'll just set up a mySQL and then change the SQL queries as needed.
But now I found this nice script called mySQL to SQL light that does a great job at least with
our database of just taking that SQL dump file and turning it into an SQL light database
and I've been writing my code against that and it's working perfectly so one Ken we may not
actually need to change the site generator code we can just you know run a script each night
to take your dump and convert it to an SQL light and then generate the site from that since
for until we get everything rewritten we will be still using the current database as it
it stands. So that will I think make things easier I had been thinking of ways to make it so that
you could have multiple databases be able to generate from the code with just minor changes to
your queries or calling which query you needed depending on which database you were calling.
So that's still possible but I don't really think we'll need to do that at this point so I think
that covers most of the basis I do encourage people to check out the site and join the repo so you
can at least I have like some issues set up like how implementing the various pages if you see a
page that I haven't listed and you want to add a new issue to implement a page if you see
something on one of the pages you know an issue I haven't gotten to fix yet go ahead please let me
you know post an issue slash bug on there. Ken Fallon does have a branch a clone of the repository
and he has a weeky setup with some of his thoughts and I have response on there you can feel free to
look on there and add your thoughts about the site in general and how best to go to proceed.
I'd like to like get more people interested in helping out but I will keep plugging away slowly and
hopefully not before another three years goes by that we'll actually have a statically generated
website I think I'll end it there and say thank you for listening and thank you for
participating in Hacker Public Radio. You have been listening to Hacker Public Radio at Hacker
Public Radio does work. Today's show was contributed by a HBR listening like yourself if you ever
thought of recording podcast and click on our contribute link to find out how easy it really is.
Posting for HBR has been kindly provided by an honesthost.com, the internet archive and
rsync.net. On this otherwise status today's show is released on their creative commons,
Attribution 4.0 International License.
