Skip to content

Support for JSON-LD #23

Open
Open

Description

@vilarfg

Perhaps I missed something, but it seems solid-meta doesn't currently expose a way to set json-ld on the head.

JSON-LD is Google's preferred schema markup and it's kind of a big deal for SEO.

I am currently trying out Solid Start and couldn't find a way to set it up, I was expecting we could do something like:

<Script type="application/ld+json">{"json linked data goes here as a string"}</Script>

Anyway, I am about to open a PR that would allow us to do:

<JSONLD>{{ key: "value", ... }}</JSONLD>

which, IMO, would be even more ergonomic.

I don't like the fact that JSONLD is all caps. Maybe we can find a better name.
Please let us not choose: JavaScriptObjectNotationLinkedData 😂

Activity

  1. ryansolid commented on Nov 28, 2022

    @ryansolid
    Member

    Hmm... special casing it vs just making it a Script tag probably goes beyond the scope of this project, keeping things minimal wrapper over native elements. You could always wrap it if we supported inserting script tags which we don't as of yet. I think we've collected a few reasons to do that now.

    So it's probably worth adding Script tags. Meta tags/Title have certain overriding characteristics and I guess Script would just insert until unmounted. Mostly haven't added it yet because the library this library is based on never did.

    Only thing I'm pondering is if limiting it in the proposed way provides some advantage over script. Ergonomics aside I wonder if there are security considerations of generic script insertion.

  2. vilarfg commented on Nov 28, 2022

    @vilarfg
    Author

    Only thing I'm pondering is if limiting it in the proposed way provides some advantage over script. Ergonomics aside I wonder if there are security considerations of generic script insertion.

    @ryansolid exactly

    That's why I came up with <JSONLD>: as it enforces type="application/ld+json" and takes care of the stringification it would do away with the security concerns.

    Another idea would be just to export MetaTag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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