From ce0fe5b080c28c94b839259fac8e5302fb281111 Mon Sep 17 00:00:00 2001 From: Nick Vella Date: Wed, 10 Jul 2019 18:45:27 +1000 Subject: [PATCH] ssg: StaticSiteClient: set ClientOptions from StaticSiteConfig --- .../Clients/StaticSite/StaticSiteClient.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs index 7c52d6f2..d312d9f0 100644 --- a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs +++ b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs @@ -9,6 +9,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Xml; +using OpenLiveWriter.Api; using OpenLiveWriter.BlogClient.Providers; using OpenLiveWriter.CoreServices; using OpenLiveWriter.Extensibility.BlogClient; @@ -261,23 +262,25 @@ namespace OpenLiveWriter.BlogClient.Clients } /// - /// Sets the relevant BlogClientOptions for this client + /// Sets the relevant BlogClientOptions for this client based on values from the StaticSiteConfig /// /// A BlogClientOptions instance private void ConfigureClientOptions(BlogClientOptions clientOptions) { - // Pages are supported if a Pages path is provided - clientOptions.SupportsPages = config.PagesPath.Length > 0; + clientOptions.SupportsPages = clientOptions.SupportsPageParent = config.PagesEnabled; + clientOptions.SupportsPostAsDraft = config.DraftsEnabled; + clientOptions.SupportsFileUpload = config.ImagesEnabled; + clientOptions.SupportsImageUpload = config.ImagesEnabled ? SupportsFeature.Yes : SupportsFeature.No; + clientOptions.SupportsScripts = clientOptions.SupportsEmbeds = SupportsFeature.Yes; - // Drafts are supported if a Drafts path is provided - clientOptions.SupportsPostAsDraft = false; // TODO ask for a drafts path - - // The follwoing values would be written into YAML front-matter + // Categories treated as tags for the time being clientOptions.SupportsCategories = true; clientOptions.SupportsMultipleCategories = true; clientOptions.SupportsNewCategories = true; - clientOptions.SupportsCustomDate = true; - clientOptions.SupportsFileUpload = true; + clientOptions.SupportsKeywords = false; + + // The follwoing values would be written into YAML front-matter + clientOptions.SupportsCustomDate = clientOptions.SupportsCustomDateUpdate = true; clientOptions.SupportsSlug = true; clientOptions.SupportsAuthor = true; }