page

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {

	// Title of the page. This is guessed from the current document. (It looks
	// for the first H1, H2, ..., H6 tag).
	Title string

	// TOC indicates whether the TOC was automatically generated
	TOC bool

	// The HTML source of the current document.
	Content template.HTML

	// The HTML source of the _header.md or _header.html file on the current
	// document's directory.
	ContentHeader template.HTML

	// The HTML source of the _footer.md or _footer.html file on the current
	// document's directory.
	ContentFooter template.HTML

	// Titles holds links to all page subtitles.
	Titles map[int][]anchor

	// Query holds the parsed map[string][]string from the URL
	Query map[string][]string

	// Data holds arbitrary data from frontmatter
	Data dig.InterfaceMap

	// Site holds site settings set in site.yaml
	Site *dig.InterfaceMap

	// An array that contains names and links of all the items on the document's
	// root. Names that begin with a dot or an underscore are ignored from the
	// listing.
	Menu []anchor

	// An array that contains names and links of all the items on the current
	// document's directory. Names that begin with a dot or an underscore are
	// ignored from the listing.
	SideMenu []anchor

	// An array of anchors that contain names and URLs of the current document's
	// path.
	BreadCrumb []anchor

	// Contains the name and URL of the current page.
	CurrentPage anchor

	// Absolute path of the current document.
	FilePath string

	// Absolute parent directory of the current document.
	FileDir string

	// Relative path of the current document.
	BasePath string

	// Relative parent directory of the current document.
	BaseDir string

	// True if the current document is / (home).
	IsHome bool

	// Pointer to the host for the search method
	Host host
}

Page struct holds information on the current document being served.

func (*Page) CreateBreadCrumb

func (p *Page) CreateBreadCrumb()

CreateBreadCrumb populates Page.BreadCrumb with links.

func (p *Page) CreateLink(file os.FileInfo, prefix string) anchor

CreateLink returns a link to another page.

func (*Page) CreateMenu

func (p *Page) CreateMenu()

CreateMenu scans files and directories and builds a list of children links.

func (*Page) CreateSideMenu

func (p *Page) CreateSideMenu()

CreateSideMenu populates Page.SideMenu with files on the current document's directory.

func (*Page) Search

func (p *Page) Search(terms []string, res int) []fulltext.SearchResultItem

Search calls host.Search()

func (*Page) URLMatch

func (p *Page) URLMatch(s string) bool

Jump to

Keyboard shortcuts

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