GetPublishedDate(IDocument, IExecutionContext, bool) Method
Gets the published date by first checking metadata for Published, then checking for a file name prefix of the form "yyyy/mm/dd-" (or the locale equivalent), then using the last modified date of the file.
Namespace
Statiq.Web
Containing Type
IDocumentExtensions

Syntax

public static DateTime GetPublishedDate(this IDocument document, IExecutionContext context, bool useLastModifiedDate = true)

Parameters

Name Type Description
document IDocument The document to get the published date for.
context IExecutionContext The execution context.
useLastModifiedDate bool true to infer published date from the file last modified date, false otherwise.

Return Value

Type Description
DateTime The published date of the document or System.DateTime.Today if a published date can't be determined.