Documentation ¶
Index ¶
- Constants
- func NewPagesFrontMatter(file string, t FormatType) (map[string]*Page, error)
- func NewPostsFrontMatter(file string, t FormatType) (map[string]*Post, error)
- func ShouldFormatExtension() map[FormatType]string
- func ShouldMetaFiles() map[FormatType]string
- func ShouldPageMetaFiles() map[FormatType]string
- func ShouldPostMetaFiles() map[FormatType]string
- func ShouldThemeMetaFiles() map[FormatType]string
- type Analytics
- type Archive
- type Archives
- type Author
- type AuthorGroup
- type Build
- type Comment
- type FormatType
- type JSON
- func (j *JSON) Bool(path ...string) bool
- func (j *JSON) Exist(path ...string) bool
- func (j *JSON) Float(path ...string) float64
- func (j *JSON) Float32(path ...string) float32
- func (j *JSON) Float64(path ...string) float64
- func (j *JSON) Floats(path ...string) []float64
- func (j *JSON) Get(path ...string) *JSON
- func (j *JSON) Index(i int) *JSON
- func (j *JSON) Int(path ...string) int
- func (j *JSON) Int16(path ...string) int16
- func (j *JSON) Int32(path ...string) int32
- func (j *JSON) Int64(path ...string) int64
- func (j *JSON) Int8(path ...string) int8
- func (j *JSON) Ints(path ...string) []int64
- func (j *JSON) Key(key string) *JSON
- func (j *JSON) Map(path ...string) map[string]*JSON
- func (j *JSON) Slice(path ...string) []*JSON
- func (j *JSON) String(path ...string) string
- func (j *JSON) Strings(path ...string) []string
- type Meta
- type MetaAll
- type Nav
- type NavGroup
- type Page
- func (p *Page) Content() []byte
- func (p *Page) ContentHTML() template.HTML
- func (p *Page) Created() time.Time
- func (p *Page) DestURL() string
- func (p *Page) IsUpdated() bool
- func (p *Page) LoadJSON(dir string) error
- func (p *Page) SetDestURL(url string)
- func (p *Page) SetPlaceholder(htmlReplacer *strings.Replacer)
- func (p *Page) SetURL(url string)
- func (p *Page) SourceURL() string
- func (p *Page) URL() string
- func (p *Page) Updated() time.Time
- type PagerPosts
- 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) DestURL() string
- func (p *Post) IsUpdated() bool
- func (p *Post) Preview() []byte
- func (p *Post) PreviewHTML() template.HTML
- func (p *Post) SetDestURL(url string)
- func (p *Post) SetPlaceholder(stringReplacer, htmlReplacer *strings.Replacer)
- func (p *Post) SetURL(url string)
- func (p *Post) SourceURL() string
- func (p *Post) URL() string
- func (p *Post) Updated() time.Time
- type PostIndex
- type Posts
- type Tag
- type TagPosts
- type Tree
- func (t *Tree) Add(link, title, linkType string, s int)
- func (t *Tree) Child(link ...string) *Tree
- func (t *Tree) Children(link ...string) []*Tree
- func (t *Tree) Dirs(link ...string) []*Tree
- func (t *Tree) FullURL() string
- func (t *Tree) HasChildren() bool
- func (t *Tree) IsValid() bool
- func (t *Tree) Nodes(link ...string) []*Tree
- func (t *Tree) Pages(link ...string) []*Tree
- func (t *Tree) Parent() *Tree
- func (t *Tree) Parents() []*Tree
- func (t *Tree) Posts(link ...string) []*Tree
- func (t *Tree) Print(prefix string)
Constants ¶
const ( // TreeIndex is index page tree node TreeIndex = "index" // TreePost is a post node TreePost = "post" // TreePage is a page node with content TreePage = "page" // TreePageNode is a empty page as tree node, not read page TreePageNode = "page-node" // TreeArchive is node of archive page TreeArchive = "archive" // TreePostList is node of list page of posts TreePostList = "post-list" // TreePostTag is node of list posts belongs to a tag TreePostTag = "post-tag" // TreeTag is node of tag page, no used now TreeTag = "tag" // TreeXML is xml file node TreeXML = "xml" // TreeDir is a directory node, use to mark directory TreeDir = "dir" )
Variables ¶
This section is empty.
Functions ¶
func NewPagesFrontMatter ¶
func NewPagesFrontMatter(file string, t FormatType) (map[string]*Page, error)
NewPagesFrontMatter parse page meta file to create page data
func NewPostsFrontMatter ¶
func NewPostsFrontMatter(file string, t FormatType) (map[string]*Post, error)
NewPostsFrontMatter parse post meta file to create post data
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
func ShouldPageMetaFiles ¶
func ShouldPageMetaFiles() map[FormatType]string
ShouldPageMetaFiles return all filenames of meta file for pages
func ShouldPostMetaFiles ¶
func ShouldPostMetaFiles() map[FormatType]string
ShouldPostMetaFiles return all filenames of meta file for posts
func ShouldThemeMetaFiles ¶
func ShouldThemeMetaFiles() map[FormatType]string
ShouldThemeMetaFiles return all filenames of meta file for theme
Types ¶
type Analytics ¶
type Analytics struct { Google string `toml:"google" ini:"google"` Baidu string `toml:"baidu" ini:"baidu"` Cnzz string `toml:"cnzz" ini:"cnzz"` }
Analytics save unique values for web analytics service
type Archives ¶
type Archives struct { Data []*Archive // contains filtered or unexported fields }
Archives is collection of all archive sets
func (*Archives) SetDestURL ¶
SetDestURL set destURL for archives
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"` Repo string `toml:"repo" ini:"repo"` // github repository IsOwner bool // must be the first author }
Author is author item in meta file
type Build ¶
type Build struct { DisablePost bool `toml:"disable_post" ini:"disable_post"` DisablePage bool `toml:"disable_page" ini:"disable_page"` PostDir string `toml:"post_dir" ini:"post_dir"` PageDir string `toml:"page_dir" ini:"page_dir"` LangDir string `toml:"lang_dir" ini:"lang_dir"` MediaDir string `toml:"media_dir" ini:"media_dir"` PostPageSize int `toml:"post_pagesize" ini:"post_pagesize"` }
Build is settings for builder 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 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 JSON ¶
type JSON struct {
// contains filtered or unexported fields
}
JSON simple reader struct
func NewJSONwithResult ¶
NewJSONwithResult create JSON struct with parsed json result
func (*JSON) Index ¶
Index get item of slice by index if current JSON is an array, otherwise return nil
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"` Build *Build `toml:"build"` }
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 Nav ¶
type Nav struct {}
Nav is item of navigation
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:"-"` Draft bool `toml:"draft" ini:"draft"` Node bool `toml:"node" ini:"node"` JSONFile string `toml:"json" ini:"json"` JSON *JSON `toml:"-" ini:"-"` Index []*PostIndex `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) SetDestURL ¶
SetDestURL set path when assemble posts
func (*Page) SetPlaceholder ¶
SetPlaceholder fix @placeholder in post values
type PagerPosts ¶
type PagerPosts struct { Posts Pager *helper.Pager URL string // contains filtered or unexported fields }
PagerPosts are list of posts by pagination
func (*PagerPosts) DestURL ¶
func (pp *PagerPosts) DestURL() string
DestURL return compile file name of paged post list
func (*PagerPosts) SetDestURL ¶
func (pp *PagerPosts) SetDestURL(url string)
SetDestURL set destUrl to paged post list
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"` Draft bool `toml:"draft" ini:"draft"` TagString []string `toml:"tags" ini:"-"` Tags []*Tag `toml:"-" ini:"-"` Author *Author `toml:"-" ini:"-"` Index []*PostIndex `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) PreviewHTML ¶
PreviewHTML get brief html content deprecated
func (*Post) SetPlaceholder ¶
SetPlaceholder fix @placeholder in post values
type PostIndex ¶
type PostIndex struct { Level int Title string Archor string Children []*PostIndex Link string Parent *PostIndex }
PostIndex is index of post
type TagPosts ¶
TagPosts are list of posts belongs to a tag
func (*TagPosts) SetDestURL ¶
SetDestURL set destUrl to tag post list
type Tree ¶
type Tree struct { Title string Link string I18n string Type string Sort int Dest string URL string // contains filtered or unexported fields }
Tree describe the position of one file in all compiled files
func (*Tree) Children ¶
Children return nodes of tree by url link in next child level, not all chilrens in all levels
func (*Tree) HasChildren ¶
HasChildren return true if Tree's children is not empty