RenderedContent *bytes.Buffer
contentType string
Draft bool
- Redirect bool
++ Aliases []string
Tmpl *template.Template
Markup string
PageMeta
func (p *Page) setSection() {
x := strings.Split(p.FileName, string(os.PathSeparator))
- section := x[len(x)-2]
-
- c := p.Site.Config
- systemDirs := map[string] bool {
- c.ContentDir: true,
- c.StaticDir: true,
- c.LayoutDir: true,
+ if len(x) <= 1 {
+ return
}
- if !systemDirs[section] && !p.Redirect {
++ //section := x[len(x)-2]
+ if section := x[len(x)-2]; section != "content" {
p.Section = section
}
++
++ //c := p.Site.Config
++ //systemDirs := map[string]bool{
++ //c.ContentDir: true,
++ //c.StaticDir: true,
++ //c.LayoutDir: true,
++ //}
++
++ //if !systemDirs[section] && !p.Redirect {
++ //p.Section = section
++ //}
}
func (page *Page) Type() string {
// TODO initalize separately... load from reader (file, or []byte)
func NewPage(filename string) *Page {
p := initializePage(filename)
+
if err := p.buildPageFromFile(); err != nil {
fmt.Println(err)
- os.Exit(1)
}
p.analyzePage()
page.layout = interfaceToString(v)
case "markup":
page.Markup = interfaceToString(v)
- case "redirect":
- page.Redirect = interfaceToBool(v)
++ case "aliases":
++ page.Aliases = interfaceArrayToStringArray(v)
++ for _, alias := range page.Aliases {
++ if strings.HasPrefix(alias, "http://") || strings.HasPrefix(alias, "https://") {
++ return fmt.Errorf("Only relative aliases are supported, %v provided", alias)
++ }
++ }
case "status":
page.Status = interfaceToString(v)
default: