Goldsmith-Breadcrumbs Goldsmith

golang goldsmith goldsmith-breadcrumbs goldsmith-components mit license web

The Goldsmith-Breadcrumbs plugin builds a content hierarchy which can be used to implement breadcrumb navigation on your site.

Usage

To use this plugin, you must declare the parent-child relationships that exist between your content files. This is accomplished by setting the CrumbName and CrumbParent metadata values. Crumb names are optional, but if specified, have to be unique across your entire web site. Crumb parent definitions specify content ancestry; pieces of content without parent crumbs are treated as root nodes. It is easy to imagine sites with several roots for different sections.

For example, if you have a “projects” page (a child of the “home” page), you could declare the metadata with Goldsmith-Frontmatter as follows:

+++
CrumbName = "projects"
CrumbParent = "home"
Title = "Projects"
+++

This plugin will store metadata value for each file with the Crumbs key. This information can then be used to render breadcrumbs with Bootstrap:

<nav class="breadcrumb">
    {{range .Meta.Crumbs.Ancestors}}<a href="/{{.File.Path}}" class="breadcrumb-item">{{.File.Meta.Title}}</a>{{end}}
    <span class="breadcrumb-item active">{{.Meta.Title}}</span>
</nav>

It is possible to set the metadata keys to be used by this plugin via the NameKey, ParentKey, and CrumbKey methods.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.