mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved error reporting in social plugin
This commit is contained in:
parent
b3ade9fd3a
commit
10b150112e
@ -188,6 +188,22 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]):
|
|||||||
if "description" in page.meta:
|
if "description" in page.meta:
|
||||||
description = page.meta["description"]
|
description = page.meta["description"]
|
||||||
|
|
||||||
|
# Check type of meta title - see https://t.ly/m1Us
|
||||||
|
if not isinstance(title, str):
|
||||||
|
log.error(
|
||||||
|
f"Page meta title of page '{page.file.src_uri}' must be a "
|
||||||
|
f"string, but is of type \"{type(title)}\"."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Check type of meta description - see https://t.ly/m1Us
|
||||||
|
if not isinstance(description, str):
|
||||||
|
log.error(
|
||||||
|
f"Page meta description of '{page.file.src_uri}' must be a "
|
||||||
|
f"string, but is of type \"{type(description)}\"."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Generate social card if not in cache - TODO: values from mkdocs.yml
|
# Generate social card if not in cache - TODO: values from mkdocs.yml
|
||||||
hash = md5("".join([
|
hash = md5("".join([
|
||||||
site_name,
|
site_name,
|
||||||
|
@ -188,6 +188,22 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]):
|
|||||||
if "description" in page.meta:
|
if "description" in page.meta:
|
||||||
description = page.meta["description"]
|
description = page.meta["description"]
|
||||||
|
|
||||||
|
# Check type of meta title - see https://t.ly/m1Us
|
||||||
|
if not isinstance(title, str):
|
||||||
|
log.error(
|
||||||
|
f"Page meta title of page '{page.file.src_uri}' must be a "
|
||||||
|
f"string, but is of type \"{type(title)}\"."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Check type of meta description - see https://t.ly/m1Us
|
||||||
|
if not isinstance(description, str):
|
||||||
|
log.error(
|
||||||
|
f"Page meta description of '{page.file.src_uri}' must be a "
|
||||||
|
f"string, but is of type \"{type(description)}\"."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Generate social card if not in cache - TODO: values from mkdocs.yml
|
# Generate social card if not in cache - TODO: values from mkdocs.yml
|
||||||
hash = md5("".join([
|
hash = md5("".join([
|
||||||
site_name,
|
site_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user