model

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package model provides the verless domain entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Footer struct {
	Items []FooterItem
}

Footer represents the website's footer.

type FooterItem

type FooterItem struct {
	Label  string
	Target string
}

FooterItem represents an item in the footer.

type ListPage added in v0.3.1

type ListPage struct {
	Page
	Pages []*Page
}

ListPage represents an overview page that is generated for each content sub-directory.

type Meta

type Meta struct {
	Title       string
	Subtitle    string
	Description string
	Author      string
	Base        string
}

Meta represents global metadata for the website.

type Nav struct {
	Items []NavItem
}

Nav represents the website's navigation.

type NavItem struct {
	Label  string
	Target string
}

NavItem represents an item in the navigation.

type Node added in v0.1.7

type Node struct {
	Pages    []Page
	ListPage ListPage
	// contains filtered or unexported fields
}

Node represents an URL like /blog that contains multiple pages, an overview page (ListPage) and child routes.

func NewNode added in v0.3.1

func NewNode() *Node

NewNode creates a new, fully initialized Node instance.

func (*Node) Children added in v0.1.7

func (n *Node) Children() map[string]tree.Node

Children returns all children of a node.

func (*Node) CreateChild added in v0.3.1

func (n *Node) CreateChild(edge string, child tree.Node)

CreateChild links a child node to the current node by the given edge name. If there's already a node behind the edge name, it will be overwritten.

func (*Node) InitChild added in v0.3.1

func (n *Node) InitChild(edge string)

InitChild initializes an empty node and links it to the current node by the given edge name.

type Page

type Page struct {
	Route       string
	ID          string
	Href        string
	Title       string
	Author      string
	Date        time.Time
	Tags        []Tag
	Img         string
	Credit      string
	Description string
	Content     string
	Related     []*Page
	Type        *Type
	Hidden      bool
	// contains filtered or unexported fields
}

Page represents a sub-page of the website.

func (*Page) AddProvidedRelated added in v0.2.0

func (p *Page) AddProvidedRelated(relatedFQN string)

AddProvidedRelated adds a new Fully Qualified Name URI to the page.

func (*Page) IsCustomListPage added in v0.4.8

func (p *Page) IsCustomListPage() bool

IsCustomListPage returns whether the page is a custom list page that has been created from a file called index.md in a content directory.

func (*Page) ProvidedRelated added in v0.2.0

func (p *Page) ProvidedRelated() []string

ProvidedRelated returns all Fully Qualified Name URIs related to the page.

func (*Page) ProvidedType added in v0.2.0

func (p *Page) ProvidedType() string

ProvidedType returns the user-provided page type.

func (*Page) SetProvidedType added in v0.2.0

func (p *Page) SetProvidedType(providedType string)

SetProvidedType sets the user-provided page type.

type Site

type Site struct {
	Meta   Meta
	Nav    Nav
	Root   *Node
	Footer Footer
}

Site represents the actual website. The site model is generated and populated with data and content during the website build.

Any build.Writer implementation is capable of rendering this model as a static website.

func NewSite added in v0.3.1

func NewSite() Site

NewSite creates a new, fully initialized Site instance.

type Tag added in v0.5.3

type Tag struct {
	Name string
	Href string
}

Tag is used for grouping pages with similar content.

func (Tag) String added in v0.5.3

func (t Tag) String() string

String implements the Stringer interface and allows accessing the name field directly in templates without calling .Name which preserves backwards compatibility with older versions.

type Type added in v0.2.0

type Type struct {
	Template string
}

Type represents a page type.

Jump to

Keyboard shortcuts

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