Skip to content

Instantly share code, notes, and snippets.

@lettergram
Created March 19, 2015 00:09
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/90daeb82b9e8555083ab to your computer and use it in GitHub Desktop.
Save lettergram/90daeb82b9e8555083ab to your computer and use it in GitHub Desktop.
// Page struct, which will contain template
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