Sitemap

Generates a sitemap from the input documents.
This module generates a sitemap from the input documents. The output document contains the sitemap XML as it's content. You can supply a location for the each item in the sitemap as a string (with an optional function to format it into an absolute HTML path) or you can supply a SitemapItem for more control. You can also specify the Hostname metadata key (as a string) for each input document, which will be prepended to all locations.

Usage

  • Sitemap(DocumentConfig sitemapItemOrLocation, Func<string, string> locationFormatter = null)

    Creates a sitemap using the specified delegate which should return either a string that contains the location for each input document or a SitemapItem instance with the location and other information.

    • sitemapItemOrLocation

      A delegate that either returns a SitemapItem instance or a string with the desired item location. If the delegate returns null, the input document is not added to the sitemap.

    • locationFormatter

      A location formatter that will be applied to the location of each input after getting the value of the specified metadata key.

  • Sitemap(Func<string, string> locationFormatter = null)

    Creates a sitemap using the metadata key SitemapItem which should contain either a string that contains the location for each input document or a SitemapItem instance with the location and other information.

    • locationFormatter

      A location formatter that will be applied to the location of each input after getting the value of the SitemapItem metadata key.

  • Sitemap(string sitemapItemOrLocationMetadataKey, Func<string, string> locationFormatter = null)

    Creates a sitemap using the specified metadata key which should contain either a string that contains the location for each input document or a SitemapItem instance with the location and other information.

    • sitemapItemOrLocationMetadataKey

      A metadata key that contains either a SitemapItem or a string location for each input document.

    • locationFormatter

      A location formatter that will be applied to the location of each input after getting the value of the specified metadata key.

Input Metadata

The metadata values listed below apply to individual documents and are typically set from front matter (with just the name of the key) and used as inputs to the module to control behavior.

  • Keys.SitemapItem: Wyam.Common.Modules.Contents.SitemapItem

    Contains a document-specific sitemap item for use when generating a sitemap.

GitHub