Skip to content

Commit 52be158

Browse files
feat: add metatag content (#680)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 6265e0a commit 52be158

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

doc/changelog.d/680.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add metatag content

src/ansys_sphinx_theme/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ def add_sidebar_context(
453453
context["sidebars"] = sidebar
454454

455455

456+
def append_og_site_name(app, pagename, templatename, context, doctree):
457+
# Make sure the context already has metatags
458+
context["metatags"] = context.get("metatags", "")
459+
460+
# Append your custom tag
461+
context["metatags"] += '\n <meta property="og:site_name" content="PyAnsys" />'
462+
463+
456464
def setup(app: Sphinx) -> Dict:
457465
"""Connect to the Sphinx theme app.
458466
@@ -499,6 +507,7 @@ def setup(app: Sphinx) -> Dict:
499507
app.connect("html-page-context", add_sidebar_context)
500508
app.connect("html-page-context", update_footer_theme)
501509
app.connect("html-page-context", fix_edit_html_page_context)
510+
app.connect("html-page-context", append_og_site_name)
502511
app.connect("build-finished", replace_html_tag)
503512
if use_ansys_search:
504513
app.connect("build-finished", create_search_index)

0 commit comments

Comments
 (0)