page

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Paginator

func Paginator(list []interface{}, number int, path string, paginatePath string) []*paginator

func Register

func Register(ext string, c creator)

Types

type Builder

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

func NewBuilder

func NewBuilder(conf config.Config, theme theme.Theme, hooks Hooks) *Builder

func (*Builder) Build

func (b *Builder) Build(ctx context.Context) error

func (*Builder) Write

func (b *Builder) Write() error

type Hook

type Hook interface {
	AfterPageParse(*Page) *Page
	BeforePageWrite(*Page) *Page
	BeforePagesWrite(Pages) Pages
	BeforeSectionsWrite(Sections) Sections
	BeforeTaxonomiesWrite(Taxonomies) Taxonomies
	BeforeTemplateWrite(map[string]interface{}) map[string]interface{}
}

type Hooks

type Hooks []Hook

func (Hooks) AfterPageParse

func (hooks Hooks) AfterPageParse(page *Page) *Page

func (Hooks) BeforePageWrite

func (hooks Hooks) BeforePageWrite(page *Page) *Page

func (Hooks) BeforePagesWrite

func (hooks Hooks) BeforePagesWrite(pages Pages) Pages

func (Hooks) BeforeSectionsWrite

func (hooks Hooks) BeforeSectionsWrite(sections Sections) Sections

func (Hooks) BeforeTaxonomiesWrite

func (hooks Hooks) BeforeTaxonomiesWrite(taxonomies Taxonomies) Taxonomies

func (Hooks) BeforeTemplateWrite

func (hooks Hooks) BeforeTemplateWrite(vars map[string]interface{}) map[string]interface{}

type Meta

type Meta map[string]interface{}

func (Meta) Done

func (m Meta) Done()

func (Meta) Get

func (m Meta) Get(k string) interface{}

func (Meta) GetBool

func (m Meta) GetBool(k string) bool

func (Meta) GetInt

func (m Meta) GetInt(k string) int

func (Meta) GetSlice

func (m Meta) GetSlice(k string) []string

func (Meta) GetString

func (m Meta) GetString(k string) string

func (Meta) GetStringMap

func (m Meta) GetStringMap(k string) map[string]interface{}

func (Meta) Set

func (m Meta) Set(k, v string)

type Page

type Page struct {
	File     string
	Meta     Meta
	Type     string
	Lang     string
	Date     time.Time
	Modified time.Time

	Path      string
	Permalink string
	Aliases   []string
	Assets    []string

	Title   string
	Summary string
	Content string

	Prev       *Page
	Next       *Page
	PrevInType *Page
	NextInType *Page

	Section *Section
}

func (*Page) Get

func (page *Page) Get(k string) interface{}

func (*Page) HasNext

func (page *Page) HasNext() bool

func (*Page) HasNextInType

func (page *Page) HasNextInType() bool

func (*Page) HasPrev

func (page *Page) HasPrev() bool

func (*Page) HasPrevInType

func (page *Page) HasPrevInType() bool

type Pages

type Pages []*Page

func (Pages) Filter

func (pages Pages) Filter(filter string) Pages

func (Pages) First

func (pages Pages) First() *Page

func (Pages) GroupBy

func (pages Pages) GroupBy(key string) TaxonomyTerms

func (Pages) Last

func (pages Pages) Last() *Page

func (Pages) OrderBy

func (pages Pages) OrderBy(key string) Pages

func (Pages) Paginator

func (pages Pages) Paginator(number int, path string, paginatePath string) []*paginator

type Reader

type Reader interface {
	Read(io.Reader) (Meta, error)
}

type Section

type Section struct {
	// slug:
	// weight:
	// aliases:
	// transparent:
	// filter:
	// orderby:
	// paginate:
	// paginate_path: {name}{number}{extension}
	// path:
	// template:
	// page_path:
	// page_template:
	// feed_path:
	// feed_template:
	File         string
	Meta         Meta
	Path         string
	Permalink    string
	Slug         string
	Title        string
	Content      string
	Pages        Pages
	HiddenPages  Pages
	SectionPages Pages
	Assets       []string
	Parent       *Section
	Children     Sections
	Lang         string
}

func (*Section) FirstName

func (sec *Section) FirstName() string

func (*Section) Name

func (sec *Section) Name() string

func (*Section) Paginator

func (sec *Section) Paginator() []*paginator

func (*Section) Root

func (sec *Section) Root() *Section

type Sections

type Sections []*Section

func (Sections) Sort

func (secs Sections) Sort()

type Taxonomies

type Taxonomies []*Taxonomy

type Taxonomy

type Taxonomy struct {
	// slug:
	// weight:
	// path:
	// template:
	// orderby:
	Meta      Meta
	Name      string
	Lang      string
	Path      string
	Permalink string
	Terms     TaxonomyTerms
}

type TaxonomyTerm

type TaxonomyTerm struct {
	// term_path: /{taxonomy}/{slug}/index.html
	// term_template:
	// term_filter:
	// term_orderby:
	// term_paginate:
	// term_paginate_path: {name}{number}{extension}
	// feed_path:
	// feed_template:
	Meta      Meta
	Name      string
	Slug      string
	Path      string
	Permalink string

	List     Pages
	Parent   *TaxonomyTerm
	Children TaxonomyTerms

	Previous *TaxonomyTerm
	Next     *TaxonomyTerm

	Taxonomy *Taxonomy
}

func (*TaxonomyTerm) FullName

func (term *TaxonomyTerm) FullName() string

func (*TaxonomyTerm) Paginator

func (term *TaxonomyTerm) Paginator() []*paginator

type TaxonomyTerms

type TaxonomyTerms []*TaxonomyTerm

func (TaxonomyTerms) Find

func (terms TaxonomyTerms) Find(name string) *TaxonomyTerm

func (TaxonomyTerms) Has

func (terms TaxonomyTerms) Has(name string) bool

func (TaxonomyTerms) OrderBy

func (terms TaxonomyTerms) OrderBy(key string) TaxonomyTerms

func (TaxonomyTerms) Paginator

func (terms TaxonomyTerms) Paginator(number int, path string, paginatePath string) []*paginator

Directories

Path Synopsis
markup

Jump to

Keyboard shortcuts

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