From b8161e01790d02277623dfebf3e6b0c7b2404365 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Tue, 18 Oct 2022 12:40:25 +0700 Subject: [PATCH] Added warning for social plugin when site_url is not defined --- material/plugins/social/plugin.py | 9 ++++++++- src/plugins/social/plugin.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/material/plugins/social/plugin.py b/material/plugins/social/plugin.py index 4a7e34cac..0c574589c 100644 --- a/material/plugins/social/plugin.py +++ b/material/plugins/social/plugin.py @@ -77,6 +77,13 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): ) sys.exit() + # Check if site URL is defined + if not config.site_url: + log.warning( + "The \"social\" plugin needs the \"site_url\" configuration " + "option to be defined. It will likely not work correctly." + ) + # Ensure presence of cache directory self.cache = self.config.cache_dir if not os.path.isdir(self.cache): @@ -262,7 +269,7 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): # Resolve image URL url = "{}.png".format(posixpath.join( - config.site_url, + config.site_url or ".", directory, file )) diff --git a/src/plugins/social/plugin.py b/src/plugins/social/plugin.py index 4a7e34cac..0c574589c 100644 --- a/src/plugins/social/plugin.py +++ b/src/plugins/social/plugin.py @@ -77,6 +77,13 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): ) sys.exit() + # Check if site URL is defined + if not config.site_url: + log.warning( + "The \"social\" plugin needs the \"site_url\" configuration " + "option to be defined. It will likely not work correctly." + ) + # Ensure presence of cache directory self.cache = self.config.cache_dir if not os.path.isdir(self.cache): @@ -262,7 +269,7 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): # Resolve image URL url = "{}.png".format(posixpath.join( - config.site_url, + config.site_url or ".", directory, file ))