model

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 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 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 Route

type Route struct {
	Children  map[string]*Route
	Pages     []Page
	IndexPage IndexPage
}

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

type Site

type Site struct {
	Meta   Meta
	Nav    Nav
	Root   Route
	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) CreateRoute

func (s *Site) CreateRoute(route string) *Route

CreateRoute creates a new route in the route tree. Has to start with a slash representing the root route, e. g. /blog.

func (*Site) ResolveRoute

func (s *Site) ResolveRoute(route string) (*Route, error)

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

func (*Site) WalkRoutes

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

WalkRoutes 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