Title

Sets a title metadata key for documents based on their file path or source.
This will split the title at special characters, capitalize first letters, remove extensions, etc.

Usage

  • Title()

    This will use the existing title metadata key if one exists, otherwise it will set a title based on the document source or the RelativeFilePath key if no source is available.

  • Title(ContextConfig title)

    This sets the title of all input documents to a value from the delegate.

    • title

      A delegate that must return a string.

  • Title(DocumentConfig title)

    This sets the title of all input documents to a value from the delegate.

    • title

      A delegate that must return a string.

  • Title(string title)

    This sets the title of all input documents to the specified string.

    • title

      The title to set.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • KeepExisting(bool keepExisting = true)

    Indicates that an existing value in the title key should be kept. The default value is true. Setting to false will always set the title metadata to the result of this module, even if the result is null or empty.

    • keepExisting

      Whether to keep the existing title metadata value.

  • WithKey(string key)

    Specifies the key to set for the title. By default this module sets a value for the key Title.

    • key

      The metadata key to set.

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.RelativeFilePath: Wyam.Common.IO.FilePath

    The path to the file relative to the input folder. This metadata value is used when generating links to the document.

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.Title: System.String

    The calculated title of the document.

GitHub