ContentRoute Pennington.Routing
Describes the canonical location of a piece of content, its output file, and originating locale.
Properties
CanonicalPathPennington.Routing.UrlPath- requiredCanonical URL path (leading slash, trailing slash for directories).
IsDefaultLocalebool- True when this route belongs to the default (unprefixed) locale.
IsFallbackbool- Default:
falseTrue when this route serves default-locale content as a fallback for a missing translation. Localestring- Default:
""Locale code for this route; empty for the default locale. OutputFilePennington.Routing.FilePath- requiredRelative output file path written during static generation.
SourceFilePennington.Routing.FilePath?- Default:
nullOriginating source file on disk, if any.
Methods
AbsoluteUrl
#public UrlPath AbsoluteUrl(UrlPath canonicalBase);Compose the canonical path with the site's canonical base URL; see Combine.
Parameters
canonicalBaseUrlPath
Returns
UrlPathWithBaseUrl
#public UrlPath WithBaseUrl(UrlPath baseUrl);Composes the canonical path with a base URL path.
Parameters
baseUrlUrlPath
Returns
UrlPathPennington.Routing.ContentRoute
namespace Pennington.Routing;
/// Describes the canonical location of a piece of content, its output file, and originating locale.
public record ContentRoute
{
/// Compose the canonical path with the site's canonical base URL; see Combine.
public UrlPath AbsoluteUrl(UrlPath canonicalBase);
/// Canonical URL path (leading slash, trailing slash for directories).
public required UrlPath CanonicalPath { get; init; }
/// True when this route belongs to the default (unprefixed) locale.
public bool IsDefaultLocale => string.IsNullOrEmpty(Locale);
/// True when this route serves default-locale content as a fallback for a missing translation.
public bool IsFallback { get; init; }
/// Locale code for this route; empty for the default locale.
public string Locale { get; init; } = "";
/// Relative output file path written during static generation.
public required FilePath OutputFile { get; init; }
/// Originating source file on disk, if any.
public FilePath? SourceFile { get; init; }
/// Composes the canonical path with a base URL path.
public UrlPath WithBaseUrl(UrlPath baseUrl);
}