builder

package
v0.0.0-...-40d8c5d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func New

func New(conf *config.SiteConfig, files fsys.FileSystem) (*Builder, error)

func (*Builder) BuildAll

func (b *Builder) BuildAll() error

BuildAll builds all the pages and posts for the site.

func (*Builder) BuildExtraPages

func (b *Builder) BuildExtraPages() error

func (*Builder) BuildOne

func (b *Builder) BuildOne(tplPath, outPath string) error

func (*Builder) BuildPostLists

func (b *Builder) BuildPostLists() error

BuildPostLists builds paginated lists of posts.

func (*Builder) BuildPostPreview

func (b *Builder) BuildPostPreview(outPath string) error

func (*Builder) BuildPosts

func (b *Builder) BuildPosts() error

BuildPosts builds all the posts in the source directory.

func (*Builder) CheckDirectories

func (b *Builder) CheckDirectories() error

func (*Builder) RemovePublic

func (b *Builder) RemovePublic() error

RemovePublic removes cached files from the public directory.

func (*Builder) Render

func (b *Builder) Render(tplName string, funcMap map[string]any, bs []byte, content *RenderContext) (string, error)

Render renders a template with the given content.

func (*Builder) RenderFile

func (b *Builder) RenderFile(tplPath string, funcMap map[string]any, content *RenderContext) (string, error)

RenderFile renders a template from a file with the given content.

func (*Builder) RenderSource

func (b *Builder) RenderSource(tplPath string, content *RenderContext) (string, error)

RenderSource renders a source template with the given content.

func (*Builder) RenderTheme

func (b *Builder) RenderTheme(tplPath string, content *RenderContext) (string, error)

RenderTheme renders a template with the given content.

func (*Builder) SyncUploads

func (b *Builder) SyncUploads() error

SyncUploads copies the uploads directory from the source to the public directory.

type Page

type Page struct {
	Posts        []*Post
	Number       int
	Total        int
	NextHref     string
	PreviousHref string
}

type Post

type Post struct {
	Title       string
	Body        string
	Blurb       string
	Href        string
	Tags        []string
	SkipIndex   bool      `yaml:"skip_index"`
	SkipPublish bool      `yaml:"skip_publish"`
	CreatedAt   time.Time `yaml:"created_at"`
	UpdatedAt   time.Time `yaml:"updated_at"`
	// contains filtered or unexported fields
}

func (*Post) UpdateFromConfig

func (p *Post) UpdateFromConfig(pc *config.PostConfig)

UpdateFromConfig updates post properties fron a config.PostConfig object.

type RenderContext

type RenderContext struct {
	Site   *config.SiteConfig
	Post   *Post
	Posts  []*Post
	Page   *Page
	Args   map[string]any
	TagMap map[string]int
}

func (*RenderContext) AddTags

func (r *RenderContext) AddTags(tags ...string)

AddTags add tags and their counts to the context.

Jump to

Keyboard shortcuts

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