Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MPages map[string]*Page
MPages is the map containing all the articles. The key is the slug of the article for low complexity access when querying a slug.
var SPages pageSlice
SPages is a sorted slice of pages. Sorted by date, it is used to render all the pages on the index page.
Functions ¶
Types ¶
type Page ¶
type Page struct {
Raw string
Markdown template.HTML
Title string
Description string
Author string
Date time.Time
DateFmt string
Tags []string
File string
Slug string
}
Page is the main struct. It contains everything needed to render the article.
func NewPageFromFile ¶
NewPageFromFile parses a file, inserts it in the map and slice, and returns a *Page instance
func (*Page) Insert ¶
Insert will try to insert the file in the MPages map and SPages slice. It will also validates that no pages have the same slug, and sort the SPages slice in case it's not a batch insertion. (A batch insertion means after all the inserts, SPages will be sorted manually)
func (*Page) ParseMarkdown ¶
ParseMarkdown will simply parse the markdown b and put it inside the Page structure.
func (*Page) ParseMetadata ¶
ParseMetadata parses the metadata on top of the markdown files. It will also raise errors when mandatory fields aren't present, or some slugs are duplicates.
func (*Page) Pop ¶
func (p *Page) Pop()
Pop removes a Page (in case the file is deleted for example)
func (*Page) UpdateFromFile ¶
UpdateFromFile parses the file once more