Skip to content

Commit

Permalink
Fixed social cards not using site name on homepage (#7608)
Browse files Browse the repository at this point in the history
Use `config.site_name` instead of `page.title`.
  • Loading branch information
pekkaklarck authored Oct 10, 2024
1 parent cf2b39d commit 829d1c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions material/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,11 @@ def _generate_meta(self, page, config):
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
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,11 @@ def _generate_meta(self, page, config):
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
Expand Down

0 comments on commit 829d1c8

Please sign in to comment.