Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
GlobCSS is a byte slice containing the style CSS of the renderer
MPages is the map containing all the articles. The key is the slug of the article for low complexity access when querying a slug.
RSS is the main RSS feed
Functions ¶
func ParseDir ¶
ParseDir cycles through a directory and parses each file one by one.
func SplitFile ¶
SplitFile splits the yaml part of a file from the actual markdown content
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
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) GetShare ¶
GetShare returns an URL for the Twitter share button
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) ParseFile ¶
ParseFile parses a whole file and fills the Page struct.
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.
Source Files
¶
- author.go
- feed.go
- file.go
- gitalk.go
- metadata.go
- pages.go
- renderer.go