- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
7.3 KiB
Plaintext
91 lines
7.3 KiB
Plaintext
Episode: 1203
|
|
Title: HPR1203: templer: a static html generator
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1203/hpr1203.mp3
|
|
Transcribed: 2025-10-17 21:33:27
|
|
|
|
---
|
|
|
|
Hey everybody, this is Chess Griffin here. It's been a long time since I've done an
|
|
HPR episode and it's good to be back. Recording this Davey 8 style, meaning in my car, I'm
|
|
recording it on my Nexus 4 phone so hopefully the quality will be okay and I apologize
|
|
if it's not, but hopefully this content will be interesting. But what I wanted to record
|
|
a little show about was about a piece of software I discovered recently. I'm posted about
|
|
this on Google Plus. It's called Templar, T-E-M-P-L-E-R, and it's developed by a guy named
|
|
Steve Kemp. I believe he's a devian developer. I know he runs the devian administration
|
|
website and he's got some other software that he's created, one's called Chronicle, which
|
|
is a flat file blog compiler, I guess you could say. But this software Templar is pretty
|
|
cool. It's a static website generator written in Perl and there's a lot of these out there,
|
|
of course, but the nice thing about what I like about this one is, now, pause for a minute,
|
|
I haven't played around with this a lot, you know, a few days or so. So this is a real
|
|
high-level 30,000-foot view of this software. But what's nice about it is, it's really small,
|
|
it's very simple to use, very self-contained, it's easy to install, very few dependencies
|
|
and it's got some really nice features. So this is what I've discovered about this. The
|
|
way this thing works is, first of all, I just pulled it from the GitHub repo into my home
|
|
directory on a server that I administer and I just seeded into that directory and ran
|
|
make and it just a quick little compile and it was done. You don't need to install it,
|
|
you know, you don't need to do make install to install a system wide, you can, or you can
|
|
just leave it there in that directory and run it as a non-root user, which is what I've
|
|
done. But it includes a couple little helper scripts and one of them will create a little
|
|
directory structure for you for a website. But the way this software works basically,
|
|
it's got three main directories for the website, for each website that you're maintaining.
|
|
There's an input directory, there's a layout directory and then there's an output directory.
|
|
And the idea is you write your pages in plain text files in the input directory. You create
|
|
your HTML templates in the layout directory. And then when the script is run, it combines
|
|
those two and outputs fully formatted HTML files in the output directory. And it uses
|
|
like template tags, like you see in a lot of blogging software and whatnot, but these
|
|
are, there's just a few of these, a few of these tags in the very simple use. So there
|
|
are some plugins that come with it, which make things handy. One is for markdown, one
|
|
is for textiles. So if you like to write in, say, markdown, you can just, there's a variable,
|
|
you can put on each page saying that the format of the page is in markdown. And that way when
|
|
the script is run, it knows to use the markdown plugin and it will convert your markdown markup
|
|
into correct HTML, you know, like for ordered lists or unordered lists or URL links or that
|
|
kind of thing. If you've used markdown, you know what I mean. It also allows you to define
|
|
global variables both by page and by layout. So if there's something you use a bit of code
|
|
or a bit of, or something that you want to drop into your footers, let's say, you know,
|
|
you want your name in a certain place where you can just define it some place and then
|
|
use the template tag and it will drop your name in wherever you put the tag. It also
|
|
can run some code when it compiles the pages, pro code and like shell commands. He's
|
|
Steve's got some examples of this. So he's got one example where it runs the command host
|
|
name. You can also set it to run date, you know, the date command with certain, and you
|
|
can format the date output. As you know, if you just run man date, you can see you can
|
|
format the date output different ways. So you could define that as a variable and then
|
|
plug in that, drop in that template tag where you want the date in the format that you
|
|
like and it will do it all correctly for you when you run the script. It also has a way
|
|
to create like a little mini gallery. One of the plug-ins, it will basically search for
|
|
files by, you know, regular expression. And so you can have it search for JPEG or PNG
|
|
files or something. And when it finds those, it will insert the image, you know, HTML tags
|
|
into the page. And so it'll create like a little mini gallery for you. It's pretty cool.
|
|
I haven't tried it, but Steve has some working examples of that on his webpage. The dependencies
|
|
for this are pretty minimal. It's really just pearl. And I think one pearl module, I
|
|
think the HTML template module, if I remember correctly, and there are some optional modules
|
|
for some of the extra features like the markdown, for example, plug in. If you want to use
|
|
that, then you've got to have the markdown pearl module installed, same with textile.
|
|
It's got a little breadcrumb plug in. If you want like a little breadcrumb trail on your
|
|
templates, there's a way to do that as well. You can have it output, you can have it read
|
|
in a file and put the output of the file into a webpage. So there's lots of different
|
|
little things it can do for such a small little piece of software. It's pretty nifty and
|
|
very clean and self-contained, and that sort of thing. So it's pretty sweet. There's
|
|
some other similar things like this out there that I've tried. I remember trying one called
|
|
Pelican a few years ago. It's a Python piece of software. And it's kind of more intended
|
|
for a blog, I guess, but it could be used for static pages. Of course, Steve's Chronicle
|
|
software, as I mentioned, I've used Blossom as a blog, and this is sort of similar to that
|
|
in a way, because Blossom can be run in static mode. So you can essentially use Blossom to
|
|
create static pages. I've used the Smarty PHP template engine before. So this is similar
|
|
to that, but it's nice because it's just one little script that you can run, and it's
|
|
very easy to do, very simple to do. You just create your four or five pages, let's say,
|
|
your index about contact, whatever, in your input directory, you've got your layouts
|
|
and your CSS style sheets in the layout directory, and then you run it, and it combines everything
|
|
and dumps it all into the output directory. And then you can copy it over to your web
|
|
post, your web route or wherever your web pages are served from. So check it out, and play
|
|
around with it, and see what you think. So anyway, that's it. Thanks again. I hope you
|
|
enjoy this, and I'll talk to you later. Bye.
|
|
You have been listening to Hacker Public Radio at Hacker Public Radio. We are a community
|
|
podcast network that releases shows every weekday Monday through Friday. Today's show,
|
|
like all our shows, was contributed by a HPR listener like yourself. If you ever considered
|
|
recording a podcast, then visit our website to find out how easy it really is. Hacker
|
|
Public Radio was founded by the Digital Dog Pound and the Infonomicum Computer Club.
|
|
HPR is funded by the binary revolution at binref.com. All binref projects are proudly sponsored
|
|
by LUNAR Pages. From shared hosting to custom private clouds, go to LUNARPages.com for
|
|
all your hosting needs. Unless otherwise stasis, today's show is released under a creative
|
|
commons, attribution, share a life, lead us our lives.
|