Documentation ¶
Index ¶
- Constants
- func ShouldFormatExtension() map[FormatType]string
- func ShouldMetaFiles() map[FormatType]string
- type Analytics
- type Archive
- type Author
- type AuthorGroup
- type Comment
- type File
- type Files
- type FormatType
- type Meta
- type MetaAll
- type Nav
- type NavGroup
- type Page
- type Pages
- type Post
- func (p *Post) Brief() []byte
- func (p *Post) BriefHTML() template.HTML
- func (p *Post) Content() []byte
- func (p *Post) ContentHTML() template.HTML
- func (p *Post) Created() time.Time
- func (p *Post) FixPlaceholder(r, hr *strings.Replacer)
- func (p *Post) FixURL(prefix string)
- func (p *Post) Preview() []byte
- func (p *Post) PreviewHTML() template.HTML
- func (p *Post) TreeURL() string
- func (p *Post) URL() string
- func (p *Post) Updated() time.Time
- type Posts
- type Tag
- type Tree
Constants ¶
const ( // FileCompiled means the file is from compiled data FileCompiled = "compiled" // FileStatic means it's copied from static directory FileStatic = "static" // FileMedia means it's copied from media directory FileMedia = "media" // OpCompiled means this file is after compiled OpCompiled = "compiled" // OpCopy mean the file is from copying operation OpCopy = "copy" // OpKeep means the file is keep, no operation OpKeep = "Keep" // OpRemove means the files is removed in this process OpRemove = "remove" )
const ( TreeIndex = "index" TreePost = "post" TreePage = "page" TreeArchive = "archive" TreePostList = "post-list" TreePostTag = "post-tag" TreeTag = "tag" )
Variables ¶
This section is empty.
Functions ¶
func ShouldFormatExtension ¶
func ShouldFormatExtension() map[FormatType]string
ShouldFormatExtension return all extensions of all formats
func ShouldMetaFiles ¶
func ShouldMetaFiles() map[FormatType]string
ShouldMetaFiles return all filenames of meta file in all format
Types ¶
type Analytics ¶
type Analytics struct { Google string `toml:"google" ini:"google"` Baidu string `toml:"baidu" ini:"baidu"` }
Analytics save unique values for web analytics service
type Author ¶
type Author struct { Name string `toml:"name" ini:"name"` Nick string `toml:"nick" ini:"nick"` Email string `toml:"email" ini:"email"` URL string `toml:"url" ini:"url"` Avatar string `toml:"avatar" ini:"avatar"` Bio string `toml:"bio" ini:"bio"` IsOwner bool // must be the first author }
Author is author item in meta file
type Comment ¶
type Comment struct { Disqus string `toml:"disqus" ini:"disqus"` Duoshuo string `toml:"duoshuo" ini:"duoshuo"` }
Comment save unique values for third-party comment systems
type Files ¶
type Files struct {
// contains filtered or unexported fields
}
Files record all relative files
type FormatType ¶
type FormatType int8
FormatType define type of front-matter format, meta file and language file
const ( // FormatTOML mean toml format FormatTOML FormatType = 1 // FormatINI mean ini format FormatINI FormatType = 2 )
type Meta ¶
type Meta struct { Title string `toml:"title" ini:"title"` Subtitle string `toml:"subtitle" ini:"subtitle"` Keyword string `toml:"keyword" ini:"keyword"` Desc string `toml:"desc" ini:"desc"` Domain string `toml:"domain" ini:"domain"` Root string `toml:"root" ini:"root"` Cover string `toml:"cover" ini:"cover"` Language string `toml:"lang" ini:"lang"` Path string `toml:"-" ini:"-"` }
Meta is meta info of website
type MetaAll ¶
type MetaAll struct { Meta *Meta `toml:"meta"` AuthorGroup AuthorGroup `toml:"author"` Comment *Comment `toml:"comment"` Analytics *Analytics `toml:"analytics"` }
MetaAll is all data struct in meta file
func NewMetaAll ¶
func NewMetaAll(data []byte, format FormatType) (*MetaAll, error)
NewMetaAll parse bytes with correct FormatType
type Page ¶
type Page struct { Title string `toml:"title" ini:"title"` Slug string `toml:"slug" ini:"slug"` Desc string `toml:"desc" ini:"desc"` Date string `toml:"date" ini:"date"` Update string `toml:"update_date" ini:"update_date"` AuthorName string `toml:"author" ini:"author"` Template string `toml:"template" ini:"template"` Lang string `toml:"lang" ini:"lang"` Bytes []byte `toml:"-"` Meta map[string]interface{} `toml:"meta" ini:"-"` Sort int `toml:"sort" ini:"sort"` Author *Author `toml:"-" ini:"-"` // contains filtered or unexported fields }
Page contain all fields of a page content
func NewPageOfMarkdown ¶
NewPageOfMarkdown create new page from markdown file
func (*Page) ContentHTML ¶
ContentHTML is page's content html
func (*Page) FixPlaceholder ¶
FixPlaceholder fix @placeholder in post values
type Post ¶
type Post struct { Title string `toml:"title" ini:"title"` Slug string `toml:"slug" ini:"slug"` Desc string `toml:"desc" ini:"desc"` Date string `toml:"date" ini:"date"` Update string `toml:"update_date" ini:"update_date"` AuthorName string `toml:"author" ini:"author"` Thumb string `toml:"thumb" ini:"thumb"` TagString []string `toml:"tags" ini:"-"` Tags []*Tag `toml:"-" ini:"-"` Author *Author `toml:"-" ini:"-"` Bytes []byte `toml:"-"` // contains filtered or unexported fields }
Post contain all fields of a post content
func NewPostOfMarkdown ¶
NewPostOfMarkdown create new post from markdown file
func (*Post) FixPlaceholder ¶
FixPlaceholder fix @placeholder in post values
func (*Post) PreviewHTML ¶
PreviewHTML get brief html content deprecated