Class
Sealed
public sealed class ThemeRenderContext
Namespace: Moka.Docs.Rendering.Scriban
Context provided to the template engine for rendering a page.
Properties
| Name | Description |
|---|---|
AllPages |
All pages in the site, used for prev/next navigation. |
Config |
Site configuration. |
CssFiles |
CSS file paths relative to output root. |
CurrentVersion |
The current version being built, if versioning is enabled. |
JsFiles |
JS file paths relative to output root. |
Navigation |
Navigation tree. |
PackageInfo |
Package metadata for NuGet install widget. |
Partials |
Partial templates keyed by name. |
Templates |
Layout templates keyed by name. |
Versions |
All configured documentation versions. |
AllPages
IReadOnlyList<DocPage> ThemeRenderContext.AllPages { get; init; }
All pages in the site, used for prev/next navigation.
Config
SiteConfig ThemeRenderContext.Config { get; init; }
Site configuration.
CssFiles
List<string> ThemeRenderContext.CssFiles { get; init; }
CSS file paths relative to output root.
CurrentVersion
DocVersion? ThemeRenderContext.CurrentVersion { get; init; }
The current version being built, if versioning is enabled.
JsFiles
List<string> ThemeRenderContext.JsFiles { get; init; }
JS file paths relative to output root.
Navigation
NavigationTree? ThemeRenderContext.Navigation { get; init; }
Navigation tree.
PackageInfo
PackageMetadata? ThemeRenderContext.PackageInfo { get; init; }
Package metadata for NuGet install widget.
Partials
Dictionary<string, string> ThemeRenderContext.Partials { get; init; }
Partial templates keyed by name.
Templates
Dictionary<string, string> ThemeRenderContext.Templates { get; init; }
Layout templates keyed by name.
Versions
IReadOnlyList<DocVersion> ThemeRenderContext.Versions { get; init; }
All configured documentation versions.
Methods
| Name | Description |
|---|---|
GetTemplate(string layoutName) |
Gets a template by layout name. |
GetTemplate(string layoutName)
string? ThemeRenderContext.GetTemplate(string layoutName)
Gets a template by layout name.
View Source
/// <summary>
/// Context provided to the template engine for rendering a page.
/// </summary>
public sealed class ThemeRenderContext
{
/// <summary>Site configuration.</summary>
public required SiteConfig Config { get; init; }
/// <summary>Navigation tree.</summary>
public NavigationTree? Navigation { get; init; }
/// <summary>Layout templates keyed by name.</summary>
public required Dictionary<string, string> Templates { get; init; }
/// <summary>Partial templates keyed by name.</summary>
public required Dictionary<string, string> Partials { get; init; }
/// <summary>CSS file paths relative to output root.</summary>
public List<string> CssFiles { get; init; } = [];
/// <summary>JS file paths relative to output root.</summary>
public List<string> JsFiles { get; init; } = [];
/// <summary>All pages in the site, used for prev/next navigation.</summary>
public IReadOnlyList<DocPage> AllPages { get; init; } = [];
/// <summary>All configured documentation versions.</summary>
public IReadOnlyList<DocVersion> Versions { get; init; } = [];
/// <summary>The current version being built, if versioning is enabled.</summary>
public DocVersion? CurrentVersion { get; init; }
/// <summary>Package metadata for NuGet install widget.</summary>
public PackageMetadata? PackageInfo { get; init; }
/// <summary>Gets a template by layout name.</summary>
public string? GetTemplate(string layoutName) => Templates.GetValueOrDefault(layoutName);
}