Documentation
¶
Index ¶
- func CleanOutputDir(dir string) error
- func ComputeOutputPath(permalink string) string
- func GenerateSitemap(pages []*content.Page, cfg config.SitemapConfig, baseURL string) ([]byte, error)
- func ResolveOutputFormat(page *content.Page) string
- func ShouldWrite(permalink string) bool
- func WriteAliases(outputDir string, aliases []string, content []byte) error
- func WriteAliasesCached(outputDir string, aliases []string, content []byte, dc *DirectoryCache) error
- func WriteFile(outputDir, relPath string, content []byte) error
- func WriteFileCached(outputDir, relPath string, content []byte, dc *DirectoryCache) error
- func WritePageFormats(outputDir string, permalink string, formats map[string][]byte) error
- type DirectoryCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanOutputDir ¶
CleanOutputDir removes all files from the output directory.
func ComputeOutputPath ¶
ComputeOutputPath computes the output file path for a given permalink. Pretty URLs: /about/ → about/index.html, / → index.html
func GenerateSitemap ¶
func GenerateSitemap(pages []*content.Page, cfg config.SitemapConfig, baseURL string) ([]byte, error)
GenerateSitemap creates a sitemap.xml from the published pages.
func ResolveOutputFormat ¶
ResolveOutputFormat determines the output format for a page. Returns "html" as default; if the page has explicit outputs, returns the first one.
func ShouldWrite ¶
ShouldWrite returns false for pages with permalink: false (data-only pages that should be processed but not written to disk).
func WriteAliases ¶
WriteAliases writes the same rendered content to all alias output paths.
func WriteAliasesCached ¶
func WriteAliasesCached(outputDir string, aliases []string, content []byte, dc *DirectoryCache) error
WriteAliasesCached is like WriteAliases but uses a DirectoryCache.
func WriteFileCached ¶
func WriteFileCached(outputDir, relPath string, content []byte, dc *DirectoryCache) error
WriteFileCached is like WriteFile but uses a DirectoryCache to skip redundant os.MkdirAll calls when many files share the same directory.
Types ¶
type DirectoryCache ¶
type DirectoryCache struct {
// contains filtered or unexported fields
}
DirectoryCache tracks which directories have been created so that repeated calls for the same directory skip the os.MkdirAll syscall.
func NewDirectoryCache ¶
func NewDirectoryCache() *DirectoryCache
NewDirectoryCache returns a ready-to-use DirectoryCache.
func (*DirectoryCache) EnsureDir ¶
func (dc *DirectoryCache) EnsureDir(dir string) error
EnsureDir creates dir (and parents) if it hasn't been created yet.