hugo: Index | Files

package pagemeta

import ""


Package Files

page_frontmatter.go pagemeta.go


const (
    Never       = "never"
    Always      = "always"
    ListLocally = "local"

type BuildConfig Uses

type BuildConfig struct {
    // Whether to add it to any of the page collections.
    // Note that the page can always be found with .Site.GetPage.
    // Valid values: never, always, local.
    // Setting it to 'local' means they will be available via the local
    // page collections, e.g. $section.Pages.
    // Note: before 0.57.2 this was a bool, so we accept those too.
    List string

    // Whether to render it.
    Render bool

    // Whether to publish its resources. These will still be published on demand,
    // but enabling this can be useful if the originals (e.g. images) are
    // never used.
    PublishResources bool
    // contains filtered or unexported fields

BuildConfig holds configuration options about how to handle a Page in Hugo's build process.

func DecodeBuildConfig Uses

func DecodeBuildConfig(m interface{}) (BuildConfig, error)

func (*BuildConfig) Disable Uses

func (b *BuildConfig) Disable()

Disable sets all options to their off value.

func (BuildConfig) IsZero Uses

func (b BuildConfig) IsZero() bool

type FrontMatterDescriptor Uses

type FrontMatterDescriptor struct {

    // This the Page's front matter.
    Frontmatter map[string]interface{}

    // This is the Page's base filename (BaseFilename), e.g., or
    // if page is a leaf bundle, the bundle folder name (ContentBaseName).
    BaseFilename string

    // The content file's mod time.
    ModTime time.Time

    // May be set from the author date in Git.
    GitAuthorDate time.Time

    // This is the Page's params.
    Params map[string]interface{}

    // This is the Page's dates.
    Dates *resource.Dates

    // This is the Page's Slug etc.
    PageURLs *URLPath

FrontMatterDescriptor describes how to handle front matter for a given Page. It has pointers to values in the receiving page which gets updated.

type FrontMatterHandler Uses

type FrontMatterHandler struct {
    // contains filtered or unexported fields

FrontMatterHandler maps front matter into Page fields and .Params. Note that we currently have only extracted the date logic.

func NewFrontmatterHandler Uses

func NewFrontmatterHandler(logger *loggers.Logger, cfg config.Provider) (FrontMatterHandler, error)

NewFrontmatterHandler creates a new FrontMatterHandler with the given logger and configuration. If no logger is provided, one will be created.

func (FrontMatterHandler) HandleDates Uses

func (f FrontMatterHandler) HandleDates(d *FrontMatterDescriptor) error

HandleDates updates all the dates given the current configuration and the supplied front matter params. Note that this requires all lower-case keys in the params map.

func (FrontMatterHandler) IsDateKey Uses

func (f FrontMatterHandler) IsDateKey(key string) bool

IsDateKey returns whether the given front matter key is considered a date by the current configuration.

type URLPath Uses

type URLPath struct {
    URL       string
    Permalink string
    Slug      string
    Section   string

Package pagemeta imports 8 packages (graph) and is imported by 9 packages. Updated 2020-04-01. Refresh now. Tools for package owners.