feat(Pandoc): Add sitename to metadata if provided

If a sitefile is provided then that data is passed via the commandline
to pandoc, this then adds it to the YAML metadata available to filters
and templates.
This commit is contained in:
Robert Morrison 2024-06-26 05:39:01 +01:00
parent ca84cafbdb
commit 0666436a59
Signed by: robert
GPG Key ID: 73E012EB3F4EC696

View File

@ -151,6 +151,11 @@ public static class Conversions{
} }
pandocArgs += " --from markdown+raw_attribute "; pandocArgs += " --from markdown+raw_attribute ";
if (!string.IsNullOrEmpty(settings.SiteName))
{
// This is used in my template to add the sitename to the title element.
pandocArgs += $" --metadata=\"SiteName:{settings.SiteName}\"";
}
if (!Directory.Exists(Path.GetDirectoryName(GetNewName(file,settings,".html")))) if (!Directory.Exists(Path.GetDirectoryName(GetNewName(file,settings,".html"))))
{ {
Directory.CreateDirectory(Path.GetDirectoryName(GetNewName(file,settings,".html"))!); Directory.CreateDirectory(Path.GetDirectoryName(GetNewName(file,settings,".html"))!);