pages

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: MIT Imports: 17 Imported by: 8

Documentation

Index

Constants

View Source
const DefaultPermalinkPattern = "/:path:output_ext"

DefaultPermalinkPattern is the default permalink pattern for pages that aren't in a collection

Variables

View Source
var PermalinkStyles = map[string]string{
	"date":    "/:categories/:year/:month/:day/:title.html",
	"pretty":  "/:categories/:year/:month/:day/:title/",
	"ordinal": "/:categories/:year/:y_day/:title.html",
	"none":    "/:categories/:title.html",
}

PermalinkStyles defines built-in styles from https://jekyllrb.com/docs/permalinks/#builtinpermalinkstyles

Functions

This section is empty.

Types

type Document

type Document interface {
	// Paths
	Permalink() string // relative URL path
	SourcePath() string
	OutputExt() string

	// Output
	Published() bool
	Static() bool
	Write(io.Writer) error

	Categories() []string
	Tags() []string
}

A Document is a Jekyll post, page, or file.

func NewFile

func NewFile(s Site, filename string, relpath string, defaults map[string]interface{}) (Document, error)

NewFile creates a Page or StaticFile.

filename is the absolute filename. relpath is the path relative to the site or collection directory.

type Page

type Page interface {
	Document
	// Content asks a page to compute its content.
	// This has the side effect of causing the content to subsequently appear in the drop.
	Content() ([]byte, error)
	SetContent(content []byte)
	FrontMatter() map[string]interface{}
	// PostDate returns the date computed from the filename or frontmatter.
	// It is an uncaught error to call this on a page that is not a Post.
	// TODO Should posts have their own interface?
	PostDate() time.Time
}

Page is a document with frontmatter.

type Site

type Site interface {
	Config() *config.Config
	RenderingPipeline() pipelines.PipelineInterface
	OutputExt(pathname string) string
}

Site is the interface that the site provides to a page.

type StaticFile

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

StaticFile is a static file.

func (*StaticFile) Categories

func (f *StaticFile) Categories() []string

Categories is in the File interface

func (*StaticFile) MarshalYAML

func (f *StaticFile) MarshalYAML() (interface{}, error)

MarshalYAML is part of the yaml.Marshaler interface The variables subcommand uses this.

func (*StaticFile) OutputExt

func (f *StaticFile) OutputExt() string

func (*StaticFile) Path

func (f *StaticFile) Path() string
func (f *StaticFile) Permalink() string

func (*StaticFile) PostDate

func (f *StaticFile) PostDate() time.Time

PostDate is part of the Page interface. FIXME move this back to Page interface, or re-work this entirely.

func (*StaticFile) Published

func (f *StaticFile) Published() bool

func (*StaticFile) SourcePath

func (f *StaticFile) SourcePath() string

func (*StaticFile) Static

func (p *StaticFile) Static() bool

Static is in the File interface.

func (*StaticFile) String

func (f *StaticFile) String() string

func (*StaticFile) Tags

func (f *StaticFile) Tags() []string

Tags is in the File interface

func (*StaticFile) ToLiquid

func (d *StaticFile) ToLiquid() interface{}

ToLiquid is part of the liquid.Drop interface.

func (*StaticFile) Write

func (p *StaticFile) Write(w io.Writer) error

Jump to

Keyboard shortcuts

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