model

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 3 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 IndexPage

type IndexPage struct {
	Page
	Pages []*Page
}

IndexPage 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 {
	Children  map[string]*Node
	Pages     []Page
	IndexPage IndexPage
}

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

type Page

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

Page represents a sub-page of the website.

func (*Page) AddRelatedFQN

func (p *Page) AddRelatedFQN(relatedFQN string)

AddRelatedFQN adds a new FullyQuallifiedName uri to the page.

func (*Page) Hidden

func (p *Page) Hidden() bool

Hidden describes if the page should be shown (false) or hidden (true).

func (*Page) RelatedFQNs

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

RelatedFQNs returns all FullyQuallifiedName uris related to the page.

func (*Page) SetHidden

func (p *Page) SetHidden(hidden bool)

SetHidden shows (false) or hides (true) the page.

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 (*Site) CreateNode added in v0.1.7

func (s *Site) CreateNode(route string) *Node

CreateNode creates a new node in the route tree. The route has to start with a slash representing the root route, e. g. /blog.

func (*Site) ResolveNode added in v0.1.7

func (s *Site) ResolveNode(route string) (*Node, error)

ResolveNode resolves and returns a route in the route tree. Has to start with a slash representing the root route.

func (*Site) WalkTree added in v0.1.7

func (s *Site) WalkTree(walkFn walkFn, maxDepth int) error

WalkTree traverses the site's route tree and invokes the given walkFn on each node. Use maxDepth = -1 to traverse all nodes.

Jump to

Keyboard shortcuts

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