1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-27 17:00:54 +01:00

Fixed social cards not using site name on homepage (#7608)

Use `config.site_name` instead of `page.title`.
This commit is contained in:
Pekka Klärck 2024-10-10 11:06:56 +03:00 committed by GitHub
parent cf2b39d1c2
commit 829d1c8db2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 6 deletions

View File

@ -339,9 +339,11 @@ class SocialPlugin(BasePlugin[SocialConfig]):
file, _ = os.path.splitext(page.file.src_uri)
# Compute page title
title = page.meta.get("title", page.title)
if not page.is_homepage:
title = f"{title} - {config.site_name}"
if page.is_homepage:
title = config.site_name
else:
page_title = page.meta.get("title", page.title)
title = f"{page_title} - {config.site_name}"
# Compute page description
description = config.site_description

View File

@ -339,9 +339,11 @@ class SocialPlugin(BasePlugin[SocialConfig]):
file, _ = os.path.splitext(page.file.src_uri)
# Compute page title
title = page.meta.get("title", page.title)
if not page.is_homepage:
title = f"{title} - {config.site_name}"
if page.is_homepage:
title = config.site_name
else:
page_title = page.meta.get("title", page.title)
title = f"{page_title} - {config.site_name}"
# Compute page description
description = config.site_description