output

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanOutputDir

func CleanOutputDir(dir string) error

CleanOutputDir removes all files from the output directory.

func ComputeOutputPath

func ComputeOutputPath(permalink string) string

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

func ResolveOutputFormat(page *content.Page) string

ResolveOutputFormat determines the output format for a page. Returns "html" as default; if the page has explicit outputs, returns the first one.

func ShouldWrite

func ShouldWrite(permalink string) bool

ShouldWrite returns false for pages with permalink: false (data-only pages that should be processed but not written to disk).

func WriteAliases

func WriteAliases(outputDir string, aliases []string, content []byte) error

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 WriteFile

func WriteFile(outputDir, relPath string, content []byte) error

WriteFile writes content to the output directory at the given relative path.

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.

func WritePageFormats

func WritePageFormats(outputDir string, permalink string, formats map[string][]byte) error

WritePageFormats writes a page's content in multiple output formats.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL