Gets the value for the specified key converted to a
IDocument
. This method never throws an exception.
It will return null if the key is not found.
- Namespace
- Statiq
.Common - Containing Type
- I
Metadata Conversion Extensions
Syntax
public static IDocument GetDocument(this IMetadata metadata, string key, IDocument defaultValue = null)
Parameters
Name | Type | Description |
---|---|---|
metadata | IMetadata | The metadata instance. |
key | string | The key of the document to get. |
defaultValue | IDocument | The default value to use if the key is not found or cannot be converted to a document. |
Return Value
Type | Description |
---|---|
IDocument | The value for the specified key converted to a document or null. |