verbis

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breadcrumbs struct {
	Enabled   bool   `json:"enabled"`
	Title     string `json:"title"`
	Separator string `json:"separator"`
	Items     Items  `json:"crumbs"`
}

Breadcrumbs represent the navigation aid for displaying hierarchical content within verbis. Various options are included within the type as well as the trail of crumbs (a slice of Items).

func GetBreadcrumbs

func GetBreadcrumbs(post *domain.PostDatum, d *deps.Deps) Breadcrumbs

GetBreadcrumbs retrieves the breadcrumbs for a specific post. If the breadcrumbs are not enabled from the options, an empty Breadcrumbs type will be returned. The homepage is automatically prepended and subsequent URL's are split and matches are looked up from the database.

type Item

type Item struct {
	Link     string `json:"link"`
	Text     string `json:"text"`
	Position int    `json:"position"`
	Found    bool   `json:"found"`
	Active   bool   `json:"active"`
}

Item represents a singular crumb. It includes the link, link text, (the post title or a clean version of the URL segment if no post was found), the position of the breadcrumb and weather or not the item was successfully retrieved from the database.

type Items

type Items []Item

Items defines the slice of crumbs within the breadcrumbs type.

func (Items) Length

func (i Items) Length() int

Length determines how many crumbs there within items.

func (Items) Reverse

func (i Items) Reverse() Items

Reverse reverse's the items slice to use the crumbs from back to front order such as Technology -> News -> Home. It returns a copy of the slice without modifying the original.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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