Documentation ¶
Index ¶
- Constants
- func ParseLayout(layoutPath string, data interface{}, project *Project) (string, error)
- type Aggregator
- type FrontMatter
- type PageSorter
- type Parser
- type Post
- type Project
- func (p *Project) AddPost(post Post)
- func (p *Project) AddTags(tag ...string)
- func (p *Project) CreatedOnSorter() PageSorter
- func (p *Project) GetLayoutsDirectory() string
- func (p *Project) GetPostsDirectory() string
- func (p *Project) GetPublicDirectory() string
- func (p *Project) GetPublicTagsPath() string
- func (p *Project) GetTags() []Tag
- func (p *Project) Posts() []Post
- func (p *Project) PostsSorted(sortFunction PageSorter) []Post
- type Tag
- type TagList
- type Writer
Constants ¶
const DefaultDelimiter = "---"
DefaultDelimiter is the default delimiter that encloses the YAML preamble
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Aggregator ¶
type Aggregator struct { }
func NewAggregator ¶
func NewAggregator() *Aggregator
func (*Aggregator) AggregatePostPaths ¶
func (a *Aggregator) AggregatePostPaths(p *Project) ([]string, error)
AggregatePostPaths scans the posts folder recursively, gathering the markdown files, providing an array of their paths
type FrontMatter ¶
type FrontMatter struct {
// contains filtered or unexported fields
}
FrontMatter will help access the front matter of the posts; the front matter is a YAML preamble enclosed by delimiters (`---`) that can provide additional metadata about the post itself (f. ex. set anouther layout, provide tags, ...) as key-value pairs. It's optional but if present it must be at the beginning of the document.
func NewFrontMatterFromSource ¶
func NewFrontMatterFromSource(src string) *FrontMatter
func (*FrontMatter) GetArrayValue ¶
func (f *FrontMatter) GetArrayValue(key string) []string
GetArrayValue will provide the value of a frontmatter field as a string array, using comma as a separator and trimming the whitespace from each string. The default will be an empty array.
func (*FrontMatter) GetBody ¶
func (f *FrontMatter) GetBody() string
GetBody will provide the contents of the post with front matter removed.
func (*FrontMatter) GetValue ¶
func (f *FrontMatter) GetValue(key, defaultVal string) string
GetValue will provide the value of a frontmatter field, or a default if not found.
func (*FrontMatter) GetValues ¶
func (f *FrontMatter) GetValues() map[string]string
type Post ¶
type Post struct { CreatedOn time.Time Title string Tags []string Source string Body template.HTML Author string Layout string Path string File string Slug string Project *Project }
Post is the logical representation of a post for the application.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project ...
func NewProject ¶
NewProject ...
func (*Project) CreatedOnSorter ¶
func (p *Project) CreatedOnSorter() PageSorter
CreatedOnSorter ...
func (*Project) GetLayoutsDirectory ¶
GetLayoutsDirectory ...
func (*Project) GetPostsDirectory ¶
GetPostsDirectory ...
func (*Project) GetPublicDirectory ¶
GetPublicDirectory ...
func (*Project) GetPublicTagsPath ¶
GetPublicTagsPath ...
func (*Project) PostsSorted ¶
func (p *Project) PostsSorted(sortFunction PageSorter) []Post
PostsSorted ...
type TagList ¶
type TagList struct {
// contains filtered or unexported fields
}
TagList ...
func NewTagList ¶
func NewTagList() *TagList
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer ...
func (*Writer) WritePages ¶
WritePages ...