page

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMatterFromPage added in v0.2.0

func NewMatterFromPage(p *Page) (pm *matter.PageMatter, err error)

func RegisterMatcherFn

func RegisterMatcherFn(matcher MatcherFn)

Types

type MatcherFn

type MatcherFn func(path string, pg *Page) (found string, ok bool)

type Page

type Page struct {
	Type   string `json:"type"`
	Format string `json:"format"`

	Url  string `json:"url"`
	Slug string `json:"slug"`
	Path string `json:"path"`

	Title       string `json:"title"`
	Summary     string `json:"summary"`
	Description string `json:"description"`

	Layout    string `json:"layout"`
	Section   string `json:"section"`
	Archetype string `json:"archetype"`

	Permalink    uuid.UUID `json:"permalink"`
	PermalinkSha string    `json:"permalink-sha"`

	Language    string       `json:"language"`
	Translates  string       `json:"translates"`
	LanguageTag language.Tag `json:"language-tag"`

	Shasum          string                 `json:"shasum"`
	Content         string                 `json:"content"`
	FrontMatter     string                 `json:"frontMatter"`
	FrontMatterType matter.FrontMatterType `json:"front-matter-type"`
	PageMatter      *matter.PageMatter     `json:"page-matter"`

	CreatedAt time.Time    `json:"created"`
	UpdatedAt time.Time    `json:"updated"`
	DeletedAt sql.NullTime `json:"deleted"`

	Context context.Context `json:"Context"`

	Formats types.FormatProvider `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(origin string, path, raw string, created, updated int64, formats types.FormatProvider, enjin context.Context) (p *Page, err error)

func NewFromPageMatter added in v0.1.0

func NewFromPageMatter(pm *matter.PageMatter, formats types.FormatProvider, enjin context.Context) (p *Page, err error)

func NewFromPageStub added in v0.1.0

func NewFromPageStub(s *fs.PageStub, formats types.FormatProvider) (p *Page, err error)

func SortPages

func SortPages(filtered []*Page, orderBy, sortDir string) (sorted []*Page)

func (*Page) Copy

func (p *Page) Copy() (copy *Page)

func (*Page) HasTranslation

func (p *Page) HasTranslation() (ok bool)

func (*Page) IsRedirection

func (p *Page) IsRedirection(path string) (ok bool)

func (*Page) IsTranslation

func (p *Page) IsTranslation(path string) (ok bool)

func (*Page) Match

func (p *Page) Match(path string) (found string, ok bool)

func (*Page) MatchPrefix

func (p *Page) MatchPrefix(prefix string) (found string, ok bool)

func (*Page) MatchQL

func (p *Page) MatchQL(query string) (ok bool, err error)

func (*Page) Redirections

func (p *Page) Redirections() (redirects []string)

func (*Page) SetFormat

func (p *Page) SetFormat(filepath string) (path string)

func (*Page) SetLanguage

func (p *Page) SetLanguage(tag language.Tag)
func (p *Page) SetPermalink(value string) (err error)

func (*Page) SetSlugUrl

func (p *Page) SetSlugUrl(filepath string)

func (*Page) String

func (p *Page) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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