Documentation
¶
Index ¶
- type Date
- type Frontmatter
- type LayoutConfig
- type Parser
- func (p *Parser) AddFile(baseDirPath string, dirEntryPath string, frontmatter Frontmatter, ...)
- func (p *Parser) DateParse(date string) time.Time
- func (p *Parser) ParseConfig(inFilePath string)
- func (p *Parser) ParseLayoutFiles() *template.Template
- func (p *Parser) ParseMDDir(baseDirPath string, baseDirFS fs.FS)
- func (p *Parser) ParseMarkdownContent(filecontent string, path string) (Frontmatter, string, string, bool)
- func (p *Parser) ParseRobots(inFilePath string, outFilePath string)
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frontmatter ¶
type Frontmatter struct {
Title string `yaml:"title"`
Date string `yaml:"date"`
Draft bool `yaml:"draft"`
JSFiles []string `yaml:"scripts"`
Description string `yaml:"description"`
PreviewImage string `yaml:"previewimage"`
Tags []string `yaml:"tags"`
TOC bool `yaml:"toc"`
Authors []string `yaml:"authors"`
Collections []string `yaml:"collections"`
Layout string `yaml:"layout"`
CustomFields []map[string]string `yaml:"customFields"`
}
type LayoutConfig ¶
type LayoutConfig struct {
BaseURL string `json:"baseURL"`
SiteTitle string `json:"siteTitle"`
SiteScripts []string `json:"siteScripts"`
Author string `json:"author"`
Copyright string `json:"copyright"`
ThemeURL string `json:"themeURL"`
Socials map[string]string `json:"socials"`
CollectionLayouts map[string]string `json:"collectionLayouts"`
}
type Parser ¶
type Parser struct {
// Templates stores the template data of all the pages of the site
// Access the data for a particular page by using the relative path to the file as the key
Templates map[template.URL]TemplateData
// K-V pair storing all templates correspoding to a particular tag in the site
TagsMap map[template.URL][]TemplateData
// Collections stores template data of files in collections
CollectionsMap map[template.URL][]TemplateData
// K-V pair storing the template layout name for a particular collection in the site
CollectionsSubPageLayouts map[template.URL]string
// Stores data parsed from layout/config.yml
LayoutConfig LayoutConfig
MdFilesName []string
MdFilesPath []string
// Stores flag value to render draft posts
RenderDrafts bool
// Common logger for all parser functions
ErrorLogger *log.Logger
Helper *helpers.Helper
// Determines the injection of Live Reload JS in HTML
LiveReload bool
// The path to the directory being rendered
SiteDataPath string
}
func (*Parser) ParseConfig ¶
func (*Parser) ParseLayoutFiles ¶
ParseLayoutFiles Parse all the ".html" layout files in the layout/ directory
func (*Parser) ParseMarkdownContent ¶
func (*Parser) ParseRobots ¶
type TemplateData ¶
type TemplateData struct {
CompleteURL template.URL
Date int64
Frontmatter Frontmatter
Body template.HTML
LiveReload bool
}
TemplateData This struct holds all of the data required to render any page of the site
Click to show internal directories.
Click to hide internal directories.