Documentation ¶
Overview ¶
Package site implements everything related to building a site.
Index ¶
- Constants
- Variables
- func EnableCache(value bool)
- func IsNotPage(err error) bool
- type Config
- type Page
- type Post
- type Posts
- type SearchConfig
- type Site
- func (s *Site) Build() (err error)
- func (s *Site) Clean() error
- func (s *Site) CopyFile(filename string) error
- func (s *Site) LayoutData() interface{}
- func (s *Site) LayoutFuncs() layouts.FuncMap
- func (s *Site) LoadAssets() error
- func (s *Site) LoadCSP() error
- func (s *Site) LoadConfig() error
- func (s *Site) LoadIncludes() (err error)
- func (s *Site) LoadLayoutFuncs() error
- func (s *Site) LoadLayouts() (err error)
- func (s *Site) LoadPageFilters() error
- func (s *Site) LoadPosts() (err error)
- func (s *Site) MakePost(title string, tags string, link string) (string, error)
- func (s *Site) ProcessAssets() error
- func (s *Site) RenderAssets() error
- func (s *Site) RenderPage(pagesDir, relname string) error
- func (s *Site) RenderPages() error
- func (s *Site) RenderPost(p *Post) error
- func (s *Site) RenderPosts() error
- func (s *Site) RenderSitemap() error
- func (s *Site) RenderTag(tag string) error
- func (s *Site) RenderTagsIndex() error
- func (s *Site) Serve(addr string) error
- func (s *Site) SetCleanBeforeBuilding(clean bool)
- func (s *Site) SetDevMode(dev bool)
- func (s *Site) StartWatching() (err error)
- func (s *Site) StopWatching()
- type StaticConfig
- type TagIndex
- type TagIndexConfig
Constants ¶
View Source
const ( ConfigFileName = "site.yml" AssetsFileName = "assets.yml" CSPFileName = "csp.yml" AssetsDirName = "assets" // just a convention, currently used for watching only IncludesDirName = "includes" LayoutsDirName = "layouts" PagesDirName = "pages" PostsDirName = "posts" DraftsDirName = "drafts" OutDirName = "out" DefaultPermalink = "blog/:year/:month/:day/:name/" DefaultPostLayout = "post" DefaultPageLayout = "default" DefaultTagIndexLayout = "tag" )
Variables ¶
View Source
var ( HTMLExtensions = []string{".html", ".htm"} MarkdownExtensions = []string{".markdown", ".md"} PostExtensions = []string{".html", ".htm", ".markdown", ".md"} )
View Source
var NotPageError = errors.New("not a page or post")
Functions ¶
func EnableCache ¶
func EnableCache(value bool)
Types ¶
type Config ¶
type Config struct { // Loadable from YAML. Name string `yaml:"name"` Author string `yaml:"author"` Permalink string `yaml:"permalink"` URL string `yaml:"url"` Static *StaticConfig `yaml:"static"` Filters map[string]interface{} `yaml:"filters"` Properties map[string]interface{} `yaml:"properties"` Search *SearchConfig `yaml:"search"` Markup *markup.Options `yaml:"markup"` Compress *filewriter.CompressConfig `yaml:"compress"` TagIndex *TagIndexConfig `yaml:"tagindex"` Sitemap string `yaml:"sitemap"` // Generated. Date time.Time Posts Posts `yaml:"-"` Tags map[string]Posts `yaml:"-"` TagList []string `yaml:"-"` }
func (Config) PostsByTag ¶
type Page ¶
type Page struct { ShortContent string // content before <!--more-->, or empty if none Basedir string Filename string // contains filtered or unexported fields }
func (*Page) SitemapEntry ¶
type SearchConfig ¶
type Site ¶
type Site struct { BaseDir string Config *Config Assets *assets.Collection Layouts *layouts.Collection PageFilters *filters.Collection CSP csp.Directives Includes map[string]string // contains filtered or unexported fields }
func (*Site) LayoutData ¶
func (s *Site) LayoutData() interface{}
func (*Site) LayoutFuncs ¶
func (*Site) LoadAssets ¶
func (*Site) LoadConfig ¶
func (*Site) LoadIncludes ¶
func (*Site) LoadLayoutFuncs ¶
func (*Site) LoadLayouts ¶
func (*Site) LoadPageFilters ¶
func (*Site) MakePost ¶
MakePost creates a new post file with the given title. It returns the filename of the created file.
func (*Site) ProcessAssets ¶
func (*Site) RenderAssets ¶
func (*Site) RenderPage ¶
func (*Site) RenderPages ¶
func (*Site) RenderPost ¶
func (*Site) RenderPosts ¶
func (*Site) RenderSitemap ¶
func (*Site) RenderTagsIndex ¶
func (*Site) SetCleanBeforeBuilding ¶
func (*Site) SetDevMode ¶
func (*Site) StartWatching ¶
func (*Site) StopWatching ¶
func (s *Site) StopWatching()
type StaticConfig ¶
type TagIndex ¶
func NewTagIndex ¶
type TagIndexConfig ¶
Click to show internal directories.
Click to hide internal directories.