sitegen

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseContent

func ParseContent(content []byte, sep string) ([]byte, []byte)

Types

type Page

type Page struct {
	Active bool
	Path   string
	Page   int
}

type Parser

type Parser func(*Source) ([]byte, error)

type SiteGen

type SiteGen struct {
	SitePath    string
	TemplateDir string
	DataDir     string
	PublicPath  string
	BasePath    string
	SourceDir   string
	Minify      *minify.M
	Webp        bool
	Clean       bool
	Dev         bool
	BuildID     string

	TplCache map[string]*texttemplate.Template
	// contains filtered or unexported fields
}

SiteGen is an instance of generator

func NewSiteGen

func NewSiteGen(sitePath, tplDir, dataDir, sourceDir, pubPath, basePath string, min *minify.M, clean bool, dev bool, webp bool) *SiteGen

func (*SiteGen) Build

func (sg *SiteGen) Build(path string) error

func (*SiteGen) BuildAll

func (sg *SiteGen) BuildAll(reload bool) (map[string]int, error)

func (*SiteGen) ClearCache

func (sg *SiteGen) ClearCache()

func (*SiteGen) Data

func (sg *SiteGen) Data(name string) interface{}

func (*SiteGen) GetSources

func (sg *SiteGen) GetSources(prop string, pattern string) []*Source

func (*SiteGen) LoadTemplate

func (sg *SiteGen) LoadTemplate(t string) error

LoadTemplate parses all templates of a specific type (ext) and stores them in cache

func (*SiteGen) LocalToPath

func (sg *SiteGen) LocalToPath(s *Source) string

func (*SiteGen) NewSource

func (sg *SiteGen) NewSource(path string, gen bool) (*Source, error)

func (*SiteGen) Path

func (sg *SiteGen) Path(path string) string

func (*SiteGen) Remove

func (sg *SiteGen) Remove(path string) error

func (*SiteGen) SourceList

func (sg *SiteGen) SourceList() []*Source

type Source

type Source struct {
	Name  string
	Local string
	Path  string
	Meta  map[string]interface{}

	Ext   string
	Ctype string

	CurrentPage int
	TotalPages  int

	Err error
	// contains filtered or unexported fields
}

func (*Source) LoadContent

func (s *Source) LoadContent() []byte

func (*Source) ReloadContent

func (s *Source) ReloadContent() []byte

func (*Source) Value

func (s *Source) Value(prop string) string

Jump to

Keyboard shortcuts

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