Documentation ¶
Index ¶
- Variables
- func Markdown(raw []byte) []byte
- func NewPostTags(posts []*Post, size int) (map[string]string, map[string][]*PostList)
- func SizeOfPostLists(lists []*PostList) int
- type Analytics
- type Archive
- type Author
- type Comment
- type Content
- type MetaData
- type MetaInfo
- type Nav
- type NavList
- type Page
- func (p *Page) Author() *Author
- func (p *Page) Content() []byte
- func (p *Page) ContentHTML() template.HTML
- func (p *Page) Created() time.Time
- func (p *Page) FromFile() string
- func (p *Page) SetAuthor(author *Author)
- func (p *Page) ToFile() string
- func (p *Page) URL() string
- func (p *Page) Updated() time.Time
- type Pager
- type PagerCursor
- type PagerItem
- type Post
- func (p *Post) Author() *Author
- 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) FromFile() string
- func (p *Post) SetAuthor(author *Author)
- func (p *Post) Tags() map[string]*PostTag
- func (p *Post) ToFile() string
- func (p *Post) URL() string
- func (p *Post) Updated() time.Time
- type PostList
- type PostTag
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorFrontMetaParseFail means front-meta is parsed fail ErrorFrontMetaParseFail = errors.New("front-meta parse fail") // ErrorContentTimeLayoutFail means time string in content is parsed fail ErrorContentTimeLayoutFail = errors.New("content time parse fail") )
Functions ¶
func NewPostTags ¶
NewPostTags build post tags and post lists of tag
func SizeOfPostLists ¶
SizeOfPostLists get all posts count from post lists
Types ¶
type Analytics ¶
type Analytics struct { Google string `toml:"google"` Baidu string `toml:"baidu"` Tencent string `toml:"tencent"` Cnzz string `toml:"cnzz"` }
Analytics is setting of third-party website analytics tool
type Archive ¶
Archive is list of archive by year
func NewArchives ¶
NewArchives return archives list with posts
type Author ¶
type Author struct { Name string `toml:"name"` Nick string `toml:"nick"` Email string `toml:"email"` URL string `toml:"url"` }
Author is author item
type Content ¶
type Content struct { Meta *MetaData Posts []*Post Lists []*PostList Tags map[string]string PostTagLists map[string][]*PostList Archives []*Archive Pages []*Page Theme *theme.Theme DstFiles map[string]bool }
Content is all data collection
func NewContent ¶
func NewContent() *Content
NewContent return new content object with proper default values
type MetaData ¶
type MetaData struct { Meta *MetaInfo `toml:"meta"` Authors []Author `toml:"author"` Comment Comment `toml:"comment"` Analytics Analytics `toml:"analytics"` // contains filtered or unexported fields }
MetaData is metadata from meta file
func ReadMetadata ¶
ReadMetadata read metadata from bytes metadata's src file is blank
func ReadMetadataFile ¶
ReadMetadataFile read metadata from file metadata's src file is set
func (*MetaData) FindAuthor ¶
FindAuthor find author by name of nickname if not found, return first author
type MetaInfo ¶
type MetaInfo struct { Title string `toml:"title"` Subtitle string `toml:"subtitle"` Keyword string `toml:"keyword"` Desc string `toml:"desc"` Root string `toml:"root"` Lang string `toml:"lang"` // contains filtered or unexported fields }
MetaInfo is basic info from metadata to describe the website
type Page ¶
type Page struct { Title string `toml:"title"` Desc string `toml:"desc"` Date string `toml:"date"` UpdateDate string `toml:"update_date"` AuthorName string `toml:"author"` IsDraft bool `toml:"draft"` Hover string `toml:"hover"` I18n string `toml:"i18n"` Template string `toml:"template"` // contains filtered or unexported fields }
Page define common web page
func NewPageFromFile ¶
NewPageFromFile read page object from file
func (*Page) ContentHTML ¶
ContentHTML return page content bytes as template.HTML
type Pager ¶
type Pager struct { Begin int End int Prev int Next int Current int Pages int All int // contains filtered or unexported fields }
Pager contains pagination data when on a page number
type PagerCursor ¶
type PagerCursor struct {
// contains filtered or unexported fields
}
PagerCursor creates Pager with each page number
func NewPagerCursor ¶
func NewPagerCursor(size, all int) *PagerCursor
NewPagerCursor with size and all count
func (*PagerCursor) Page ¶
func (pg *PagerCursor) Page(i int) *Pager
Page creates Pager on a page number
func (*PagerCursor) Pages ¶
func (pg *PagerCursor) Pages() []*Pager
Pages return all pages from cursor
type Post ¶
type Post struct { Title string `toml:"title"` Slug string `toml:"slug"` Desc string `toml:"desc"` Date string `toml:"date"` UpdateDate string `toml:"update_date"` AuthorName string `toml:"author"` TagList []string `toml:"tags"` IsDraft bool `toml:"draft"` // contains filtered or unexported fields }
Post define blog post
func NewPostFromFile ¶
NewPostFromFile read post from file
func (*Post) ContentHTML ¶
ContentHTML return post content bytes as template.HTML