infogami wiki

share your infogami tips and tricks

templates

Infogami is controlled through a system of templates. Currently, there are two main ones:

_template

This is the template that controls every page on the site, including login, preferences, and more.

It supports the following variables:

  • $body -- this is the key one; it causes the template to include the content of your page so don't delete it!
  • $pagetitle -- this one contains the title of the page; you might put it in the <title> tag and in an <h1> or something
  • $ pagehead -- this contains stylesheets and javascript and things to put in the <head> of the page
  • $ads -- shows our text ads and the Infogami logo
    • you can control the color of the text ads by setting the javascript variables site_background_color and site_text_color
  • $sitetitle -- the title of the website (set in prefs)
  • $sitesubtitle -- the subtitle of the website (ditto)
  • $loginbox -- the login box that lets users log in and log out

_pagetemplate

This is the template that draws web pages, including blog entries. It's a much more powerful template, giving you access to basic programming constructs like if statements.

It supports the following variables:

  • $url -- the url of the entry
  • $author.name -- the name of the author (or anonymous)
  • $title -- title of the page
  • $rawbody -- the raw Markdown for the page
  • $body -- the page converted to HTML
  • $made -- the date this version of the page was made
  • $timesince(made) -- a function converting the date to a human readable version like "2 days ago"
  • $if theycan('...', this): -- tests to see if a user has the '...' permission

Be very careful: if you add any other $ things -- including any of those from the first category above -- your site will not work. (Obviously this is a bug and will be fixed, but that's the story for now.