-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to also make the meta tags in the theme pluggable as well? #530
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Would sphinxext-opengraph work for you? That's how I've done custom metadata before... |
You can also explicitly set metadata using |
Thank you @choldgraf and @pradyunsg I will start with pradyunsg suggestion because it seems less intrusive. so the meta:: is in the frontmatter of each .md page? assume i am using jupyter-book. Any documentation on this? I. tried to search by metadata but don't find it. https://jupyterbook.org/start/create.html?highlight=metadata separately i realized my question was wrongly phrasedI now realized the desire to swap out google analytics with plausible means i need to insert a script tag not a meta tag in head. Apologies. Directionally, my question is the same. How do i insert custom elements in the head such as a different analytics provider script tag? |
What exactly do you want to inject? See https://pradyunsg.me/furo/customisation/injecting/, which is from the documentation of a different theme -- it discusses the mechanisms that Sphinx provides for injecting code into any arbitrary theme. |
Also if you're using jupyter book, you can inject scripts via these docs too https://jupyterbook.org/advanced/html.html#custom-css-or-javascript |
i need to insert a javascript snippet in the head. Not to add new javascript code per se. So the injecting custom-css-or-javascript doesn't seem to be applicable. i might be wrong of course Also I read the custom code injecting for furo, I'm sorry to say I'm at a loss as to how I can use that for my case. |
According to this https://www.sphinx-doc.org/en/master/templating.html#working-with-the-builtin-templates there's this thing called I know sphinx-book-theme inherits (?) from pydata-sphinx-theme so i found this https://github.com/pydata/pydata-sphinx-theme/blob/3c11db8b4e4b764a5bdb2460a44a7f68cb54e26b/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html#L11 Is there a way to add more script tags into the extrahead? |
Would it be better if i fork this theme to add the javascript snippet? |
Closing this to consolidate under executablebooks/meta#726 |
Describe the problem/need and solution
Context
I need to add a different HTML meta head element because i am not using google analytics. I want to use plausible
Problem / Idea
Allow theme user to plugin custom meta head element as and when they need it?
Solution
Perhaps follow #470 and make it more pluggable?
Benefit
There are several options available for people to do this:
This would benefit the people trying to have more tailoring within the chosen sphinx-book-theme.
Guide for implementation
Just allow users to write their own html meta and the theme just inserts it. that way, minimum effort on dev and maximum flexibility
Tasks and updates
No response
The text was updated successfully, but these errors were encountered: