hugo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: ISC, Apache-2.0 Imports: 16 Imported by: 0

README

hugo v0.49.2

The few files in this directory are copied from the hugo repository at tag hugo@v0.49.2 and only slightly modified. It's the easiest way to get working what I needed to work as the few required functions are well isolated. I've added Hugo's Apache License v2.0.

Documentation

Index

Constants

View Source
const (

	// HTMLLead identifies the start of HTML documents.
	HTMLLead = "<"
	// YAMLLead identifies the start of YAML frontmatter.
	YAMLLead = "-"
	// YAMLDelim identifies the YAML front matter delimiter.
	YAMLDelim = "---"
	// TOMLLead identifies the start of TOML front matter.
	TOMLLead = "+"
	// TOMLDelim identifies the TOML front matter delimiter.
	TOMLDelim = "+++"
	// JSONLead identifies the start of JSON frontmatter.
	JSONLead = "{"
	// HTMLCommentStart identifies the start of HTML comment.
	HTMLCommentStart = "<!--"
	// HTMLCommentEnd identifies the end of HTML comment.
	HTMLCommentEnd = "-->"
	// BOM Unicode byte order marker
	BOM = '\ufeff'
)

Variables

This section is empty.

Functions

func HandleJSONMetaData

func HandleJSONMetaData(datum []byte) (map[string]interface{}, error)

HandleJSONMetaData unmarshals JSON-encoded datum and returns a Go interface representing the encoded data structure.

func HandleTOMLMetaData

func HandleTOMLMetaData(datum []byte) (map[string]interface{}, error)

HandleTOMLMetaData unmarshals TOML-encoded datum and returns a Go interface representing the encoded data structure.

func HandleYAMLMetaData

func HandleYAMLMetaData(datum []byte) (map[string]interface{}, error)

HandleYAMLMetaData unmarshals YAML-encoded datum and returns a Go interface representing the encoded data structure.

func URLEscape

func URLEscape(uri string) (string, error)

Types

type Config

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

func (*Config) GetBool

func (c *Config) GetBool(v string) bool

func (*Config) GetStringMapString

func (c *Config) GetStringMapString(v string) map[string]string

type FrontmatterType

type FrontmatterType struct {
	// Parse decodes content into a Go interface.
	Parse func([]byte) (map[string]interface{}, error)
	// contains filtered or unexported fields
}

FrontmatterType represents a type of frontmatter.

func DetectFrontMatter

func DetectFrontMatter(mark rune) (f *FrontmatterType)

DetectFrontMatter detects the type of frontmatter analysing its first character.

type Page

type Page interface {
	// FrontMatter contains the raw frontmatter with relevant delimiters.
	FrontMatter() []byte

	// Content contains the raw page content.
	Content() []byte

	// Body contains the full document.
	Body() []byte

	// IsRenderable denotes that the page should be rendered.
	IsRenderable() bool

	// Metadata returns the unmarshalled frontmatter data.
	Metadata() (map[string]interface{}, error)
}

Page represents a parsed content page.

func ReadFrom

func ReadFrom(r io.Reader) (p Page, err error)

ReadFrom reads the content from an io.Reader and constructs a page.

type PageMetadata

type PageMetadata struct {
	Title      string
	Slug       string
	Summary    string
	Categories []string
	Tags       []string
	Date       time.Time
	Draft      bool

	Filepath  string
	Subdir    string
	Permalink string
}

type PathPattern

type PathPattern string

PathPattern represents a string which builds up a URL from attributes

func (PathPattern) Expand

func (pp PathPattern) Expand(m *PageMetadata) (string, error)

Expand on a PathPattern takes a Content and returns the fully expanded Permalink or an error explaining the failure.

Jump to

Keyboard shortcuts

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