Back to godoc.org

Package collection

v0.0.0-...-42a2ac9
Latest Go to latest

The latest major version is .

Published: Aug 14, 2020 | License: MIT | Module: github.com/FooSoft/goldsmith-components

Overview

Package collection groups related pages into named collections. This can be useful for presenting blog posts on your front page, and displaying summary information about other types of content on your website. It can be used in conjunction with the "pager" plugin to create large collections which are split across several pages.

Index

type Collection

type Collection struct {
	// contains filtered or unexported fields
}

Collection chainable plugin context.

func New

func New() *Collection

New creates a new instance of the Collection plugin.

func (*Collection) CollectionKey

func (plugin *Collection) CollectionKey(collectionKey string) *Collection

CollectionKey sets the metadata key used to access the collection name (default: "Collection"). The metadata associated with this key can be either a single string or an array of strings.

func (*Collection) Comparer

func (plugin *Collection) Comparer(comparer Comparer) *Collection

Comparer sets the function used to sort files in collection groups (default: sort by filenames).

func (*Collection) Finalize

func (plugin *Collection) Finalize(context *goldsmith.Context) error

func (*Collection) GroupsKey

func (plugin *Collection) GroupsKey(groupsKey string) *Collection

GroupsKey sets the metadata key used to store information about collection groups (default: "Groups"). This information is stored as a mapping of group names to contained files.

func (*Collection) Initialize

func (*Collection) Initialize(context *goldsmith.Context) (goldsmith.Filter, error)

func (*Collection) Name

func (*Collection) Name() string

func (*Collection) Process

func (plugin *Collection) Process(context *goldsmith.Context, inputFile *goldsmith.File) error

type Comparer

type Comparer func(i, j *goldsmith.File) (less bool)

A Comparer callback function is used to sort files within a collection group.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier