owl-blogs/domain/model/page.go

37 lines
602 B
Go
Raw Normal View History

2023-07-09 19:04:59 +00:00
package model
import (
"fmt"
"owl-blogs/render"
)
type Page struct {
EntryBase
meta PageMetaData
}
type PageMetaData struct {
Title string `owl:"inputType=text"`
Content string `owl:"inputType=text widget=textarea"`
}
func (e *Page) Title() string {
return e.meta.Title
}
func (e *Page) Content() EntryContent {
str, err := render.RenderTemplateToString("entry/Page", e)
if err != nil {
fmt.Println(err)
}
return EntryContent(str)
}
func (e *Page) MetaData() interface{} {
return &e.meta
}
func (e *Page) SetMetaData(metaData interface{}) {
e.meta = *metaData.(*PageMetaData)
}