breadcrumbs

package
v0.0.0-...-bb92df6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: OSL-3.0 Imports: 3 Imported by: 0

README

Breadcrumbs

The breadcrumbs module contains a small helper that supports breadcrumb navigation data.

It can be used from two perspectives:

  • other modules controller can add typical breadcrumb parts - for example the category module adds breadcrumb parts that shows the root category down to the current category. Or the product controller adds the correct breadcrumb to the product view.
  • you can use the collected breadcrumb in your template

Usage in templates

Call the data function. For example, in the pug template engine a usage can look like this:

var breadCrumbData = data('breadcrumbs')
ul
  each item, index in breadCrumbData    
    li
      if item.url === ""
        span.breadcrumbNoLink=item.title
      else
        a(href=item.url)=item.title

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, b Crumb)

Add a breadcrumb to the current context

Types

type Controller

type Controller struct{}

Controller defines the data controller

func (*Controller) Data

func (bc *Controller) Data(ctx context.Context, _ *web.Request, _ web.RequestParams) interface{}

Data controller

type Crumb

type Crumb struct {
	Title string
	URL   string
	Code  string
}

Crumb defines a breadcrumb

type Module

type Module struct{}

Module for breadcrumbs

func (*Module) Configure

func (m *Module) Configure(injector *dingo.Injector)

Configure module

Jump to

Keyboard shortcuts

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