This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

ContentRouteFactory Pennington.Routing

Creates ContentRoute instances from source file paths or URL paths.

Methods

ForRedirect

#
public static ContentRoute ForRedirect(UrlPath sourceUrl)

Redirect: source URL to route (output is redirect HTML).

Parameters

sourceUrl UrlPath

Returns

ContentRoute

FromCustom

#
public static ContentRoute FromCustom(UrlPath url, FilePath? sourceFile = default, string locale = "")

Custom: for non-markdown content services.

Parameters

url UrlPath
sourceFile FilePath?
locale string

Returns

ContentRoute

FromMarkdownFile

#
public static ContentRoute FromMarkdownFile(FilePath sourceFile, FilePath contentRoot, UrlPath basePageUrl, string locale = "")

Markdown: file path to route. Converts a markdown file path relative to contentRoot into a URL. Example: sourceFile="Content/Docs/getting-started.md", contentRoot="Content/Docs", basePageUrl="/docs" results in CanonicalPath="/docs/getting-started/", OutputFile="docs/getting-started/index.html"

Parameters

sourceFile FilePath
contentRoot FilePath
basePageUrl UrlPath
locale string

Returns

ContentRoute

FromRazorPage

#
public static ContentRoute FromRazorPage(string pageRoute, string locale = "")

Razor: @page directive to route.

Parameters

pageRoute string
locale string

Returns

ContentRoute

FromUrl

#
public static ContentRoute FromUrl(UrlPath url, string locale = "")

Programmatic: explicit URL to route.

Parameters

url UrlPath
locale string

Returns

ContentRoute

Pennington.Routing.ContentRouteFactory

namespace Pennington.Routing;

/// Creates ContentRoute instances from source file paths or URL paths.
public class ContentRouteFactory
{
    /// Redirect: source URL to route (output is redirect HTML).
    
public static ContentRoute ForRedirect(UrlPath sourceUrl)
; /// Custom: for non-markdown content services.
public static ContentRoute FromCustom(UrlPath url, FilePath? sourceFile = default, string locale = "")
; /// Markdown: file path to route. Converts a markdown file path relative to contentRoot into a URL. Example: sourceFile="Content/Docs/getting-started.md", contentRoot="Content/Docs", basePageUrl="/docs" results in CanonicalPath="/docs/getting-started/", OutputFile="docs/getting-started/index.html"
public static ContentRoute FromMarkdownFile(FilePath sourceFile, FilePath contentRoot, UrlPath basePageUrl, string locale = "")
; /// Razor: @page directive to route.
public static ContentRoute FromRazorPage(string pageRoute, string locale = "")
; /// Programmatic: explicit URL to route.
public static ContentRoute FromUrl(UrlPath url, string locale = "")
; }