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
sourceUrlUrlPath
Returns
ContentRouteFromCustom
#public static ContentRoute FromCustom(UrlPath url, FilePath? sourceFile = null, string locale = "");Custom: for non-markdown content services.
Parameters
urlUrlPathsourceFileFilePath? (optional)localestring (optional)
Returns
ContentRouteFromMarkdownFile
#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
sourceFileFilePathcontentRootFilePathbasePageUrlUrlPathlocalestring (optional)
Returns
ContentRouteFromRazorPage
#public static ContentRoute FromRazorPage(string pageRoute, string locale = "");Razor: @page directive to route.
Parameters
pageRoutestringlocalestring (optional)
Returns
ContentRouteFromUrl
#public static ContentRoute FromUrl(UrlPath url, string locale = "");Programmatic: explicit URL to route.
Parameters
urlUrlPathlocalestring (optional)
Returns
ContentRoutePennington.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 = "");
}