Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 18, 2015 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lettergram/7a1c9a4f3914cf05e5c3 to your computer and use it in GitHub Desktop.
Save lettergram/7a1c9a4f3914cf05e5c3 to your computer and use it in GitHub Desktop.
type Page struct {
Title string
Body template.HTML
UserData template.HTML
Bar template.HTML
}
// Loads a page for use
func loadPage(title string, r *http.Request) (*Page, error) {
filename, option, usr, bar := user.LoadUserInfo(title, r)
body, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return &Page{Title: title, Body: template.HTML(body), UserData: (template.HTML(usr) + template.HTML(option)), Bar: template.HTML(bar)}, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment