Hacking Infogami

How to get the most of the host

Known Template Codes

These are codes that, when used in the templates for Page and Site, will be replaced with generated content when the page is saved and viewed.

  • $pagetitle - The title of the page that you've entered in the "title" box when editing the page.
  • $sitetitle - The title for the whole site, entered in the "Prefs" page.
  • $sitesubtitle - The subtitle of the whole site, also entered in "Prefs"
  • $timesince(made) - When the current page was last updated.
  • $url - The relative path of the current page (eg: "foo.html" for http://yoursite.infogami.com/foo.html)
  • $if theycan('permission_name_here'): <code/expression> - Insert conditional code based on the permissions available to the current user. If the user doesn't have the permission, the code following the directive up and until a new line will not be evaluated. The beginning of a condition must appear on a new line and can't have anything but whitespace come before it, otherwise it'll cause an "internal server error". The permissions known so far are:
    1. edit - can edit a page
    2. history - can view the history of a page
  • $body - The contents of the current page.
  • $loginbox - A macro for either a login form, or the identity of the user if she's already logged in.
  • {{sidebar}} - An include directive (?) for the sidebar, edited separately.
  • $ads - An iframe containing a Google AdSense tower-style banner.

More? Is there an official list of template codes somewhere?

Moving (And Removing) The Google Ads

It appears that if you edit the Site template and just remove the reference to $ads, then the Google AdWords will disappear. I'm not sure why Infogami lets you do this, since the site appears to be supported by those ads, but one idea is that to give the user the greatest freedom of design, the entire page's appearance had to be surrendered to the templating engine. This is at least nicer than the way GeoCities and other ad-supported hosting services worked, which was to either put your site in a frameset to protect the advertising frame, or to do some ugly post-processing of the HTML.

Regardless, since each site on Infogami continues to exist at the discretion of Infogami's makers, it might be polite to leave them in somewhere.

Creating Additional Pages

How to create new pages on Infogami

Embedding Images Without Hosting Image Files

Note: Remove this when/if Infogami supports uploading media

If you can't host an image on an external server yourself, you could still get an image into an Infogami page by using the "data URL" technique, where the data for an image is encoded in base64 and used as the SRC for an image tag. If your browser supports it, you should see the image of a pussycat below:

Guess your browser can't show it

To show images in an Infogami page you need to use the Markdown syntax:

![Alt text of the image](path/to/the/image)

The path between the parenthesis is where you'd need to paste the data URL, like this:

![Alt text of the image](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA...)

Sveinbjorn Thordarson has an online data URL generator that you can upload any image to and convert into a proper data URL. Note that the example code he gives you is for a regular HTML <img> tag, and not a Markdown style image tag. You need to cut-n-paste the part between the quotes of the SRC="" attribute into the parenthesis of your Markdown image tag.

Creating Custom CSS Stylesheets

Stolen from Dave's Place

Edit the Site template and comment out Infogami's default stylesheet.

Next, plug the following into your browser's URL/Address field and go to it:

http://<sitename>.infogami.com/_edit/local_style.css

the _edit part of the URL prompts Infogami to start creating a new page. Since the filename does not end in .html, Infogami does not put the body of the page in a template, and you can safely put your new stylesheet here.

Once saved, you can now edit the Site template again and put in a reference like this in the header:

The material here is Public Domain.