Skip to content

Meta tags: Potential bug or documentation inconsistency #996

Open
@JovanVeljanoski

Description

@JovanVeljanoski

Hi!

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions