Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GlobCSS template.CSS
GlobCSS is a byte slice containing the style CSS of the renderer
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 RSS *feeds.Feed
RSS is the main RSS feed
Functions ¶
func UpdateRSSFeed ¶
func UpdateRSSFeed()
UpdateRSSFeed will update the items in the RSS feed to reflect the changes
Types ¶
type Author ¶
type Author struct { Name string `yaml:"name"` Twitter string `yaml:"twitter"` Site string `yaml:"site"` Github string `yaml:"github"` Avatar string `yaml:"avatar"` }
Author represents the author of a single article
func GetGlobalAuthor ¶
func GetGlobalAuthor() *Author
GetGlobalAuthor retrieves the author configured in the configuration file Returns a nil pointer if nothing is defined
type Gitalk ¶
type Gitalk struct { Enabled bool `yaml:"enabled"` ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` Repo string `yaml:"repo"` Owner string `yaml:"owner"` Admin []string `yaml:"admin"` }
Gitalk is a struct holding all the information necessary to make gitalk work
type MetaData ¶
type MetaData struct { Title string `yaml:"title"` // Mandatory Description string `yaml:"description"` Banner string `yaml:"banner"` Author *Author `yaml:"author,omitempty"` Slug string `yaml:"slug"` Tags []string `yaml:"tags"` Date string `yaml:"date"` // Mandatory Draft bool `yaml:"draft"` }
MetaData is a struct that helps the unmarshalling of the yaml header in markdown files.
func (*MetaData) GenerateSlug ¶
GenerateSlug will generate a slug if necessary, based on the title of the article. Otherwise it will return the slug set in the metadata
type Page ¶
type Page struct { Raw string Markdown template.HTML Title string Description string Author *Author Banner string Date time.Time DateFmt string Tags []string File string Slug string Draft bool }
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