public static StaticSiteItemFrontMatter GetFromYaml(StaticSiteConfigFrontMatterKeys frontMatterKeys, string yaml) { var frontMatter = new StaticSiteItemFrontMatter(frontMatterKeys); frontMatter.Deserialize(yaml); return(frontMatter); }
/// <summary> /// Create a new StaticSiteConfigFrontMatterKeys instance and load configuration from blog credentials /// </summary> /// <param name="blogCredentials">An IBlogCredentialsAccessor</param> public static StaticSiteConfigFrontMatterKeys LoadKeysFromCredentials(IBlogCredentialsAccessor blogCredentials) { var frontMatterKeys = new StaticSiteConfigFrontMatterKeys(); frontMatterKeys.LoadFromCredentials(blogCredentials); return(frontMatterKeys); }
public static StaticSiteItemFrontMatter GetFromBlogPost(StaticSiteConfigFrontMatterKeys frontMatterKeys, BlogPost post) { var frontMatter = new StaticSiteItemFrontMatter(frontMatterKeys); frontMatter.LoadFromBlogPost(post); return(frontMatter); }
/// <summary> /// Load site configuration from blog credentials /// </summary> /// <param name="creds">An IBlogCredentialsAccessor</param> public void LoadFromCredentials(IBlogCredentialsAccessor creds) { LocalSitePath = creds.Username; PostsPath = creds.GetCustomValue(CONFIG_POSTS_PATH); PagesEnabled = creds.GetCustomValue(CONFIG_PAGES_ENABLED) == "1"; PagesPath = creds.GetCustomValue(CONFIG_PAGES_PATH); DraftsEnabled = creds.GetCustomValue(CONFIG_DRAFTS_ENABLED) == "1"; DraftsPath = creds.GetCustomValue(CONFIG_DRAFTS_PATH); ImagesEnabled = creds.GetCustomValue(CONFIG_IMAGES_ENABLED) == "1"; ImagesPath = creds.GetCustomValue(CONFIG_IMAGES_PATH); BuildingEnabled = creds.GetCustomValue(CONFIG_BUILDING_ENABLED) == "1"; OutputPath = creds.GetCustomValue(CONFIG_OUTPUT_PATH); BuildCommand = creds.GetCustomValue(CONFIG_BUILD_COMMAND); PublishCommand = creds.GetCustomValue(CONFIG_PUBLISH_COMMAND); SiteUrl = creds.GetCustomValue(CONFIG_SITE_URL); // This will be overidden in LoadFromBlogSettings, HomepageUrl is considered a more accurate source of truth ShowCmdWindows = creds.GetCustomValue(CONFIG_SHOW_CMD_WINDOWS) == "1"; if (creds.GetCustomValue(CONFIG_CMD_TIMEOUT_MS) != string.Empty) { CmdTimeoutMs = int.Parse(creds.GetCustomValue(CONFIG_CMD_TIMEOUT_MS)); } Initialised = creds.GetCustomValue(CONFIG_INITIALISED) == "1"; // Load FrontMatterKeys FrontMatterKeys = StaticSiteConfigFrontMatterKeys.LoadKeysFromCredentials(creds); }
public StaticSiteItemFrontMatter(StaticSiteConfigFrontMatterKeys frontMatterKeys) { _frontMatterKeys = frontMatterKeys; Tags = new string[] { }; // Initialize Tags to empty array }