ISite

The main configuration of the program, primarily extracted from the app.yaml file.

Properties

Options

(IGenerateOptions) { get; set }: Command line options

SourceContentPath

(string) : The path of the content, based on the source path.

SourceStaticPath

(string) : The path of the static content (that will be copied as is), based on the source path.

SourceThemePath

(string) : The path theme.

CacheManager

(SiteCacheManager) : Manage all caching lists for the site

Parser

(IFrontMatterParser) : Front Matter parser

TemplateEngine

(ITemplateEngine) : The template engine.

Logger

(ILogger) : The logger instance.

SourceFolders

(IEnumerable) : List of all basic source folders

LanguageList

(IReadOnlyList) : All resolved languages, sorted by weight then code.

DefaultLanguageObj

(LanguageSettings) : The resolved default language.

IsMultilingual

(bool) : True when the site declares more than one language.

I18n

(IReadOnlyDictionary<string, IReadOnlyDictionary<string, I18nEntry>>) : Translation strings loaded from the i18n/ directory, keyed by language code then by translation key. Used by the i18n Liquid filter.

Public Methods

GetLanguage

public LanguageSettings GetLanguage(string? code)

Returns the resolved language for the given code, falling back to the default.

Parameters:

  • code (string?)

Returns: LanguageSettings

IsConfiguredLanguage

public bool IsConfiguredLanguage(string code)

True when the code matches a language explicitly configured under languages.

Parameters:

  • code (string)

Returns: bool

ResetCache

public void ResetCache()

Resets the template cache to force a reload of all templates.

ScanAndParseSourceFiles

public void ScanAndParseSourceFiles(IFileSystem fs, string? directory = null, int level = 0, ContentSource? parent = null, FrontMatter? cascade = null)

Search recursively for all markdown files in the content folder, then parse their content for front matter and markdown.

Parameters:

  • fs (IFileSystem)
  • directory (string?): Folder to scan (Default: null)
  • level (int): Folder recursive level (Default: 0)
  • parent (ContentSource?): Page of the upper directory (Default: null)
  • cascade (FrontMatter?) (Default: null)

BuildTranslationGroups

public void BuildTranslationGroups()

Groups content sources that are translations of each other. Must be called after all source files have been scanned and before pages are processed.

ProcessPages

public void ProcessPages()

Expand the front matter to full-blown pages.

RegisterPaginatedUrls

public void RegisterPaginatedUrls()

Register paginated URL entries in OutputReferences after all pages are created. Must be called after ProcessPages so ContentSourceToPages is fully populated.

 Uri CreatePermalink(Page page, string? urlForce = null)

Gets the Permalink path for the file.

Parameters:

  • page (Page)
  • urlForce (string?): The URL to consider. If null use the predefined URL (Default: null)

Returns: Uri

  • The output path.

PostProcessPage

public void PostProcessPage(IPage page, bool overwrite = false)

Extra calculation and automatic data for each page.

Parameters:

  • page (IPage): The given page to be processed
  • overwrite (bool) (Default: false)

IsPageValid

public bool IsPageValid(IContentSource frontMatter, IGenerateOptions? options)

Check if the page have the conditions to be published: valid date and not draft, unless a command line option to force it.

Parameters:

  • frontMatter (IContentSource): Page or front matter
  • options (IGenerateOptions?): options

Returns: bool

IsDateValid

public bool IsDateValid(IContentSource contentSource, IGenerateOptions? options)

Check if the page have a publishing date from the past.

Parameters:

  • contentSource (IContentSource): Page or content Source
  • options (IGenerateOptions?): options

Returns: bool

IsDateExpired

public bool IsDateExpired(IContentSource contentSource)

Check if the page is expired

Parameters:

  • contentSource (IContentSource)

Returns: bool

IsDatePublishable

public bool IsDatePublishable(IContentSource contentSource)

Check if the page is publishable

Parameters:

  • contentSource (IContentSource)

Returns: bool

PageCreate

public List<Page> PageCreate(ContentSource contentSource)

Create a Page from front matter

Parameters:

  • contentSource (ContentSource)

Returns: List<Page>

ContentSourceAdd

 ContentSource? ContentSourceAdd(ContentSource? contentSource)

Include the Front Matter into the site

Parameters:

  • contentSource (ContentSource?)

Returns: ContentSource?

ParseAndRenderTemplate

 string ParseAndRenderTemplate(Page page, bool b)

Parameters:

  • page (Page)
  • b (bool)

Returns: string