Added warning for social plugin when site_url is not defined

This commit is contained in:
squidfunk 2022-10-18 12:40:25 +07:00
parent ed6f0b1b57
commit b8161e0179
2 changed files with 16 additions and 2 deletions

View File

@ -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
))

View File

@ -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
))