Site Map - skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr1203 :: templer: a static html generator

An introduction to Steve Kemp's static site generator, written in Perl

<< First, < Previous, Latest >>

Hosted by Chess Griffin on 2013-03-13 is flagged as Explicit and is released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. | Comments (2)

In today's show Chess talks to us about a static html generator written in perl called templer

Templer

Templer is yet another static site generator, written in Perl.

It makes use of the HTML::Template module for performing variable expansion within pages and layouts, along with looping and conditional-statement handling.

Templer has evolved over time for my own personal use, but I believe it is sufficiently generic it could be useful to others.

My motivation for putting it together came from the desire to change several hand-made, HTML-coded, sites to something more maintainable such that I could easily change the layout in one place.

The design evolved over time but the key reason for keeping it around is that it differs from many other simple static-generators in several ways:

  • You may define global variables for use in your pages/layouts.
  • A page may define and use page-specific variables.
  • You may change the layout on a per-page basis if you so wish.
    • This was something that is missing from a lot of competing tools.
  • Conditional variable expansion is supported, via HTML::Template.
  • File contents, shell commands, and file-globs may be used in the templates
    • This allows the trivial creation of galleries, for example.
    • These are implemented via plugins.
  • You may also embed perl code in your pages.

Another key point is that the layouts allow for more than a single simple "content" block to be placed into them - you can add arbitrary numbers of optional side-menus, for example.

Although this tool was written and used with the intent you'd write your site-content in HTML you can write your input pages in Textile or Markdown if you prefer (these inputs are supported via plugins).


Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2013-03-13T23:07:17Z by Klaatu

Checkmate

I told you all that Chess would be back. NOW do you believe me??

Comment #2 posted on 2014-03-14T18:50:50Z by Steve Kemp

Thanks for your templer coverage

It is nice to see other people seeing/using templer, and bug reports/suggestions are always welcome.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to
record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?
Are you a spammer →
Who hosted this show →
What does HPR mean to you ?