diff --git a/mkdocs_rss_plugin/config.py b/mkdocs_rss_plugin/config.py index a1be4e5b..ea25a265 100644 --- a/mkdocs_rss_plugin/config.py +++ b/mkdocs_rss_plugin/config.py @@ -18,14 +18,14 @@ class RssPluginConfig(Config): abstract_chars_count = config_options.Type(int, default=160) abstract_delimiter = config_options.Type(str, default="") - categories = config_options.Type(list, default=None) - comments_path = config_options.Type(str, default=None) - date_from_meta = config_options.Type(dict, default=None) + categories = config_options.ListOfItems(config_options.Type(str), default=[]) + comments_path = config_options.Optional(config_options.Type(str)) + date_from_meta = config_options.Optional(config_options.Type(dict)) enabled = config_options.Type(bool, default=True) feed_ttl = config_options.Type(int, default=1440) - image = config_options.Type(str, default=None) + image = config_options.Optional(config_options.Type(str)) length = config_options.Type(int, default=20) match_path = config_options.Type(str, default=".*") pretty_print = config_options.Type(bool, default=False) - url_parameters = config_options.Type(dict, default=None) + url_parameters = config_options.Optional(config_options.Type(dict)) use_git = config_options.Type(bool, default=True) diff --git a/mkdocs_rss_plugin/plugin.py b/mkdocs_rss_plugin/plugin.py index 31e760ac..3a121e1b 100644 --- a/mkdocs_rss_plugin/plugin.py +++ b/mkdocs_rss_plugin/plugin.py @@ -89,23 +89,23 @@ def on_config(self, config: config_options.Config) -> dict: # start a feed dictionary using global config vars base_feed = { - "author": config.get("site_author", None), + "author": config.site_author or None, "buildDate": formatdate(get_build_timestamp()), - "copyright": config.get("copyright", None), - "description": config.get("site_description", None), + "copyright": config.copyright, + "description": config.site_description, "entries": [], "generator": f"{__title__} - v{__version__}", "html_url": self.util.get_site_url(config), "language": self.util.guess_locale(config), "pubDate": formatdate(get_build_timestamp()), - "repo_url": config.get("repo_url", config.get("site_url", None)), + "repo_url": config.repo_url, "title": config.get("site_name", None), - "ttl": self.config.get("feed_ttl", None), + "ttl": self.config.feed_ttl, } # feed image - if self.config.get("image"): - base_feed["logo_url"] = self.config.get("image") + if self.config.image: + base_feed["logo_url"] = self.config.image # pattern to match pages included in output self.match_path_pattern = compile(self.config.get("match_path"))