From 0666436a59265fb218c3fad7a4ce5143f9f3a38d Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Wed, 26 Jun 2024 05:39:01 +0100 Subject: [PATCH] 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. --- SiteFile/SiteFile.ConverterFunctions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SiteFile/SiteFile.ConverterFunctions.cs b/SiteFile/SiteFile.ConverterFunctions.cs index 7c29063..fdf0874 100644 --- a/SiteFile/SiteFile.ConverterFunctions.cs +++ b/SiteFile/SiteFile.ConverterFunctions.cs @@ -151,6 +151,11 @@ public static class Conversions{ } 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")))) { Directory.CreateDirectory(Path.GetDirectoryName(GetNewName(file,settings,".html"))!);