Documentation ¶
Overview ¶
Package blog contains helpers for manipulating site and blog source files.
Index ¶
Constants ¶
const ( HeaderTOML = "+++\n" HeaderYAML = "---\n" )
The header of supported metadata types.
Variables ¶
This section is empty.
Functions ¶
func Slug ¶
Slug attempts to guess the slug that the final page will have by checking if the metadata has a "slug" attribute and, if not, generating one from the filename (the full path should be passed so that trees such as "mypost/index.md" can be recognized as a post called 'mypost' and not 'index').
Types ¶
type Metadata ¶
type Metadata map[string]interface{}
Metadata contains parsed metadata including the type of the metadata in the file, and the offset of where the metadata ends.
func (Metadata) Decode ¶
Decode extracts metadata from the provided page. It assumes the first byte is the metadata header.
It supports decoding TOML wrapped in "+++\n" and YAML wrapped in "---\n" similar to Hugo or Jekyll and returns the header that it finds.
func (Metadata) GetBool ¶
GetBool parses the metadata value for key and returns it as a bool. If the underlying value is not a valid bool, an empty string is returned.