You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When looking at the docstrings of solara.Head we see this:
A component that manager the "head" tag of the page to avoid duplicate tags, such as titles.
Currently only supports the [title](/documentation/components/page/title) tag as child, e.g.:
```python
import solara
@solara.component
def Page():
with solara.VBox() as main:
MyAwesomeComponent()
with solara.Head():
solara.Title("My page title")
return main
```
However in the docs of solara.Meta we see that this can also be in the solara.Head :
"""Add a meta tag to the head element, or replace a meta tag with the same name and or property.
This component should be used inside a [Head](/documentation/components/page/head) component, e.g.:
```python
import solara
@solara.component
def Page():
with solara.VBox() as main:
MyAwesomeComponent()
with solara.Head():
solara.Meta(name="description", property="og:description", content="My page description")
solara.Meta(property="og:title", content="My page title for social media")
solara.Meta(property="og:image", content="https://solara.dev/static/assets/images/logo.svg")
solara.Meta(property="og:type", content="website")
return main
```
Anyway, my point is.. i have been trying various approaches and I can't get the open-graph tags to propaga to the head correctly.
I have tried various attempts to include them in my Layout component (which is practically identical to the one solara offers for multi-page apps, with an attempt to add the meta og tags).
I have also tried following the example from the solara.dev page itself that is also in the solara repo, but also nothing.
Either there is some funny bug, or am i doing something wrong (probably the latter since the solara.dev website works).
Can someone please explain what is the expected way of using these components to add the OG/Twitter tags?
Many thanks!
The text was updated successfully, but these errors were encountered:
JovanVeljanoski
changed the title
Potential bug or documentation inconsistency
Meta tags: Potential bug or documentation inconsistency
Feb 6, 2025
Our documentation of solara.Head is incorrect, and should also accept Meta elements.
There is some funny bug going on with the Meta tags. (I'm looking into it)
I'm not sure if you were already running SSG, but I think most likely in order for the og tags to be picked up they need to be present in the raw HTML that the server sends. So you need to run SSG in order for them to work.
I looked into the code and to the best of my understanding, anything with SSG is solara enterprise territory, so I do not want to touch it.
Also, I kind of figured out that if i edit the "base" server template and add tags manually there, things work as expected. But it is not nice thing to do. Maybe if there can be a way to use a custom "base template" ( I ask that here ), that would solve things.
On the other and solara.Title() works as expected!
Hi!
When looking at the docstrings of
solara.Head
we see this:However in the docs of
solara.Meta
we see that this can also be in thesolara.Head
:Anyway, my point is.. i have been trying various approaches and I can't get the open-graph tags to propaga to the head correctly.
I have tried various attempts to include them in my
Layout
component (which is practically identical to the one solara offers for multi-page apps, with an attempt to add the meta og tags).I have also tried following the example from the
solara.dev
page itself that is also in the solara repo, but also nothing.Either there is some funny bug, or am i doing something wrong (probably the latter since the solara.dev website works).
Can someone please explain what is the expected way of using these components to add the OG/Twitter tags?
Many thanks!
The text was updated successfully, but these errors were encountered: