This site provides a machine-readable index at /llms.txt.

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 = null, string locale = "");

Custom: for non-markdown content services.

Parameters

url UrlPath
sourceFile FilePath? (optional)
locale string (optional)

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 (optional)

Returns

ContentRoute

FromRazorPage

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

Razor: @page directive to route.

Parameters

pageRoute string
locale string (optional)

Returns

ContentRoute

FromUrl

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

Programmatic: explicit URL to route.

Parameters

url UrlPath
locale string (optional)

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 = null, 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 = "");
}