pages

package
v0.0.0-...-7c623fc Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(root string) (pages map[string]*Resp, err error)

Load intializes a root directory and serves all sub-folders.

Types

type Meta

type Meta struct {
	Image    string
	Title    string
	Message  string
	Sort     *int
	Expanded bool
}

Meta defines the attributes to be loaded from the meta.toml file

type Node

type Node struct {
	Slug     string  `json:"slug"`
	Title    string  `json:"title"`
	Active   bool    `json:"active,omitempty"`
	Expanded bool    `json:"expanded,omitempty"`
	Sort     *int    `json:"sort,omitempty"`
	Nav      []*Node `json:"nav,omitempty"`
	// contains filtered or unexported fields
}

Node is a recursive node in a page tree.

func NewNode

func NewNode(path, slug, title string) *Node

NewNode creates a new node with it's path, slug and page title.

func (*Node) AddNode

func (n *Node) AddNode(root []string, p string, title string, paths []string, active bool, expanded bool, sort *int)

AddNode adds a node to the node tree.

func (*Node) Num

func (n *Node) Num() int

Num returns the recursive number of pages under this node.

type Resp

type Resp struct {
	Title     string          `json:"title"` // Human-readable title.
	Slug      string          `json:"slug"`  // URL-slug.
	URL       string          `json:"url"`
	UpdatedAt string          `json:"updated_at"` // Body update time.
	Image     string          `json:"image"`      // Path/URL/Placeholder to image.
	Message   string          `json:"message"`    // Message to show at top
	Body      string          `json:"body"`       // Main content of the page.
	Sidebar   string          `json:"sidebar"`    // The sidebar of the page.
	Sort      *int            `json:"sort"`       // The order that the tab should appear in on the page
	Expanded  bool            `json:"expanded"`   // Should the Nav-tree rooted in this node always be expanded one step when loaded?
	Anchors   []anchor.Anchor `json:"anchors"`    // The list of anchors to headers in the body.
	Nav       []*Node         `json:"nav,omitempty"`
}

Resp is the response we serve for file queries.

Jump to

Keyboard shortcuts

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