Skip to content
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

Support for JSON-LD #23

Open
vilarfg opened this issue Nov 27, 2022 · 2 comments · May be fixed by #24
Open

Support for JSON-LD #23

vilarfg opened this issue Nov 27, 2022 · 2 comments · May be fixed by #24

Comments

@vilarfg
Copy link

vilarfg commented Nov 27, 2022

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 😂

@vilarfg vilarfg linked a pull request Nov 27, 2022 that will close this issue
@ryansolid
Copy link
Member

ryansolid commented Nov 28, 2022

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.

@vilarfg
Copy link
Author

vilarfg commented Nov 28, 2022

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants