Site
- Namespace: SuCoS.Models
- Source File: Site.cs
The main configuration of the program, primarily extracted from the app.yaml file.
Properties
Params
(Dictionary<string, object>) { get; set }
Title
(string)
Description
(string?)
Copyright
(string?)
BaseUrl
(Uri) { get; set }
UglyUrLs
(bool)
Paginate
(int)
PaginatePath
(string)
KindOutputFormats
(Dictionary<Kind, List
Languages
(Dictionary<string, LanguageSettings>)
DefaultLanguage
(string)
DefaultContentLanguageInSubdir
(bool)
I18n
(IReadOnlyDictionary<string, IReadOnlyDictionary<string, I18nEntry>>) { get; set } = new Dictionary<string, IReadOnlyDictionary<string, I18nEntry>>()
LanguageList
(IReadOnlyList[]: All resolved languages, sorted by weight then code.
DefaultLanguageObj
(LanguageSettings) { get; set } = new(): The resolved default language.
IsMultilingual
(bool): True when the site declares more than one language.
SuCoS
(Sucos) = new Sucos()
Options
(IGenerateOptions) { get; set }
Theme
(Theme?)
SourceContentPath
(string)
SourceStaticPath
(string)
SourceThemePath
(string)
OutputReferences
(ConcurrentDictionary<Uri, IOutput>) = []
Pages
(IEnumerable
AllRegularPages
(IEnumerable
RegularPages
(IEnumerable
Home
(IPage?) { get; set }
CacheManager
(SiteCacheManager) = new()
Parser
(IFrontMatterParser)
TemplateEngine
(ITemplateEngine)
Logger
(ILogger)
SourceFolders
(IEnumerable
FilesParsedToReport
(int): Number of files parsed, used in the report.
Public Methods
GetLanguage
public LanguageSettings GetLanguage(string? code)
Returns the resolved language for the given code, falling back to the default language.
Parameters:
code(string?)
Returns: LanguageSettings
IsConfiguredLanguage
public bool IsConfiguredLanguage(string code)
True when the given code matches a language explicitly configured under the languages key (used to recognize filename language suffixes).
Parameters:
code(string)
Returns: bool
LoadTranslations
public void LoadTranslations()
Loads translation strings from i18n/*.yaml files. Each file is named {languageCode}.yaml and contains a flat or Hugo-compatible mapping of translation keys to their localized values.
ResetCache
public void ResetCache()
ScanAndParseSourceFiles
public void ScanAndParseSourceFiles(IFileSystem fs, string? directory, int level = 0, ContentSource? parent = null, FrontMatter? cascade = null)
Parameters:
fs(IFileSystem)directory(string?)level(int) (Default:0)parent(ContentSource?) (Default:null)cascade(FrontMatter?) (Default:null)
PostProcessPage
public void PostProcessPage(IPage page, bool overwrite = false)
Parameters:
page(IPage)overwrite(bool) (Default:false)
CreatePermalink
public Uri CreatePermalink(Page page, string? urlTemplate = null)
Parameters:
page(Page)urlTemplate(string?) (Default:null)
Returns: Uri
IsPageValid
public bool IsPageValid(IContentSource contentSource, IGenerateOptions? options)
Parameters:
contentSource(IContentSource)options(IGenerateOptions?)
Returns: bool
IsDateValid
public bool IsDateValid(IContentSource contentSource, IGenerateOptions? options)
Parameters:
contentSource(IContentSource)options(IGenerateOptions?)
Returns: bool
IsDateExpired
public bool IsDateExpired(IContentSource contentSource)
Parameters:
contentSource(IContentSource)
Returns: bool
IsDatePublishable
public bool IsDatePublishable(IContentSource contentSource)
Parameters:
contentSource(IContentSource)
Returns: bool
PageCreate
public List<Page> PageCreate(ContentSource contentSource)
Parameters:
contentSource(ContentSource)
Returns: List<Page>
ProcessPages
public void ProcessPages()
Create pages from content source
RegisterPaginatedUrls
public void RegisterPaginatedUrls()
BuildTranslationGroups
public void BuildTranslationGroups()
Groups content sources that share a translation key, so each page can enumerate its translations. Must be called after all source files have been scanned.
ContentSourceAdd
public ContentSource? ContentSourceAdd(ContentSource? contentSource)
Parameters:
contentSource(ContentSource?)
Returns: ContentSource?
ParseAndRenderTemplate
public string ParseAndRenderTemplate(Page page, bool isBaseTemplate)
Parameters:
page(Page)isBaseTemplate(bool)
Returns: string