49 lines
885 B
Go
49 lines
885 B
Go
package sitebuilder
|
|
|
|
import (
|
|
"html/template"
|
|
"io/fs"
|
|
"time"
|
|
|
|
"lmika.dev/lmika/weiro/models"
|
|
)
|
|
|
|
const (
|
|
// Template names
|
|
|
|
// tmplNamePostSingle is the template for single post (postSingleData)
|
|
tmplNamePostSingle = "posts_single.html"
|
|
|
|
// tmplNamePostList is the template for list of posts (postListData)
|
|
tmplNamePostList = "posts_list.html"
|
|
|
|
// tmplNameLayoutMain is the template for the main layout (layoutMainData)
|
|
tmplNameLayoutMain = "layout_main.html"
|
|
)
|
|
|
|
type Options struct {
|
|
SiteMeta models.SiteMeta
|
|
|
|
// BasePosts is the base path for posts.
|
|
BasePosts string
|
|
|
|
// TemplatesFS provides the raw templates for rendering the site.
|
|
TemplatesFS fs.FS
|
|
|
|
RenderTZ *time.Location
|
|
}
|
|
|
|
type postSingleData struct {
|
|
Meta models.PostMeta
|
|
HTML template.HTML
|
|
Path string
|
|
}
|
|
|
|
type postListData struct {
|
|
Posts []postSingleData
|
|
}
|
|
|
|
type layoutData struct {
|
|
Body template.HTML
|
|
}
|