44 lines
909 B
Go
44 lines
909 B
Go
|
package view
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
// Regular pages are defined as views here, like the homepage
|
||
|
|
||
|
// Major components of each page.
|
||
|
const (
|
||
|
index = `view/_index.gohtml`
|
||
|
header = `view/_header.gohtml`
|
||
|
footer = `view/_footer.gohtml`
|
||
|
)
|
||
|
|
||
|
// These constitute the static parts of the site that don't need to change, loaded as a template for rendering
|
||
|
const (
|
||
|
home = `view/static/home.gohtml`
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
if fi, err := os.Stat(index); err != nil {
|
||
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
||
|
}
|
||
|
if fi, err := os.Stat(header); err != nil {
|
||
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
||
|
}
|
||
|
if fi, err := os.Stat(footer); err != nil {
|
||
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
||
|
}
|
||
|
if fi, err := os.Stat(home); err != nil {
|
||
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
||
|
}}
|
||
|
|
||
|
var ViewHome *View
|
||
|
|
||
|
func init() {
|
||
|
log.Println("Initializing homepage")
|
||
|
var err error
|
||
|
ViewHome, err = NewFromFile(home)
|
||
|
log.Println(err)
|
||
|
}
|