Examples
Pipelines.Add("Posts",
ReadFiles("*.md"),
Markdown(),
WriteFiles("html")
);
Pipelines.Add("Archive",
ReadFiles("archive.cshtml"),
Paginate(10,
Documents("Posts")
),
Razor(),
WriteFiles(string.Format("archive-{0}.html", @doc["CurrentPage"]))
);
Usage
-
Paginate(int pageSize, IEnumerable<IModule> modules)Partitions the result of the specified modules into the specified number of pages. The input documents to Paginate are used as the initial input documents to the specified modules.
pageSizeThe number of documents on each page.
modulesThe modules to execute to get the documents to page.
-
Paginate(int pageSize, params IModule[] modules)Partitions the result of the specified modules into the specified number of pages. The input documents to Paginate are used as the initial input documents to the specified modules.
pageSizeThe number of documents on each page.
modulesThe modules to execute to get the documents to page.
Fluent Methods
Chain these methods together after the constructor to modify behavior.
-
SkipPages(int count)Skips a specified number of pages before outputting pages.
countThe number of pages to skip.
-
TakePages(int count)Only outputs a specific number of pages.
countThe number of pages to output.
-
Where(DocumentConfig predicate)Limits the documents to be paged to those that satisfy the supplied predicate.
predicateA delegate that should return a
bool.
-
WithPageMetadata(string key, DocumentConfig metadata)Adds the specified metadata to each page index document. This must be performed within the paginate module. If you attempt to process the page index documents from the paginate module after execution, it will "disconnect" metadata for those documents like
Wyam.Common.Meta.Keys.NextPagesince you're effectivly creating new documents and the ones those keys refer to will be outdated.keyThe key of the metadata to add.
metadataA delegate with the value for the metadata.
Output Metadata
The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.
-
Keys.CurrentPage:System.Int32The index of the current page (1 based).
-
Keys.HasNextPage:System.BooleanWhether there is another page after this one.
-
Keys.HasPreviousPage:System.BooleanWhether there is another page before this one.
-
Keys.NextPage:Wyam.Common.Documents.IDocumentThe next page.
-
Keys.PageDocuments:IEnumerable<IDocument>Contains all the documents for the current page.
-
Keys.PreviousPage:Wyam.Common.Documents.IDocumentThe previous page.
-
Keys.TotalItems:System.Int32The total number of items across all pages.
-
Keys.TotalPages:System.Int32The total number of pages.
