Content

Dynamic templates

If the [site directory]/templates files are executable, they will be run when Pagegen generates the site and their output used.

A good use of this is to setup a footer which has a copyright notice showing the current year. Do this by setting the [site directory]/templates/footer to the following.

 #!/bin/bash
 echo "<div id="copyright">Copyright © $(date +%Y)</div>"
 echo "</body>"
 echo "</html>"

Make the footer template executable chmod +x [site dir]/templates/footer

When the site is generated each page will have a footer with the current year.

This example uses a bash script, but any executable can be used to generate content.

Last changed 2009-10-17 21:09