Here you can edit the template by which the content below is generated. More info
edit code

Write your own templates

written on: Saturday, June 1 2013 at 16:32 (UTC)


The little thingy below the menu lets you edit the template by which this content is generated. You can edit and play with it as much as you like.

Google Go

This whole website is driven by an app written in go. You can find it's homepage here. In my opinion, it's one of the best languages out there. It combines a lot of good things from other languages. If you want to start exploring go, I suggest you take the tour first. The only downside is that it isn't used that much, and documentation can be scarce. Also, you can use go in Google App Engine, and combined with the template package, it makes up for a very good language to use for webapps.

Templating

The package "html/template" implements data-driven templates for generating textual output. You can find documentation about it here (for the html version) and here (for the text version). If you want to experiment with the nifty thingy above; here is the struct Article:

type Article struct {
  Title string
  ShortName string
    // usually the title in lower case without special
    // characters, spaces replaced by the '-' character.
  Picture string // path to picture
  Date time.Time
  Tags []string
  Visible bool // not actually used
  SmallContent []byte
  Content []byte
}
There are two extra functions to use, namely ToHTML and ReadableDate.