Documentation ¶
Overview ¶
Package pager splits arrays of metadata into standalone pages. The plugin is initialized with a lister callback which is used to segment a slice of metadata contained within the provided file. While any large set of metadata can be split into segments, this plugin is particularly useful when working with the "collection" for paging blog entries, photos, etc.
Index ¶
- type Index
- type Lister
- type Namer
- type Page
- type Pager
- func (self *Pager) EnableKey(key string) *Pager
- func (self *Pager) Finalize(ctx *goldsmith.Context) error
- func (self *Pager) InheritedKeys(keys ...string) *Pager
- func (*Pager) Initialize(context *goldsmith.Context) error
- func (self *Pager) ItemsPerPage(limit int) *Pager
- func (*Pager) Name() string
- func (self *Pager) Namer(namer Namer) *Pager
- func (self *Pager) PagerKey(key string) *Pager
- func (self *Pager) Process(context *goldsmith.Context, inputFile *goldsmith.File) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lister ¶
Lister callback function is used to return a metadata slice which should be paged across several files.
type Namer ¶
Namer callback function builds paths for file pages based on the original file path and page index.
type Pager ¶
type Pager struct {
// contains filtered or unexported fields
}
Pager chainable context.
func (*Pager) EnableKey ¶
EnableKey sets the metadata key used to determine if the current file should be paged (default: false).
func (*Pager) InheritedKeys ¶
InheritedKeys sets which metadata keys should be copied to generated pages from the original file (default: []). When no keys are provided, all metadata is copied from the original file to generated pages.
func (*Pager) ItemsPerPage ¶
ItemsPerPage sets the maximum number of items which can be included on a single page (default: 10).
func (*Pager) Namer ¶
Namer sets the callback used to build paths for file pages. Default naming inserts page number between file name and extension, for example "file.html" becomes "file-2.html".