Add alternate integration utility for using SEO in remix #650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WHY are these changes introduced?
This PR adds a simple utility for using the Hydrogen storefront SEO generated tags directly in a meta function.
WHAT is this pull request doing?
Given that we introduced the pattern / ability of returning an
seo
key in a loader (see #591) I became interested in seeing how an alternate approach would look if we didn't even bother with the<Seo />
component rendered in the root and instead provided compatibility functions for use in the page module exports (links, meta, scripts, etc...). This is just a proof of concept of this different adaptor approach.With this approach we could basically just do the following:
The
tagsToMetaArray
name is wrong, and we'd probably provide one more layer of wrapping here (ie:generateMetaFromSeo
,generateLinksFromSeo
).This approach is more aligned with how remix works and uses more of their built-ins which is the main benefit of going this route. I anticipate this leading to less bugs, confusion and ties us more directly to their design choices. An example of what I mean here that I think is worth calling out is the lack of route inheritance and no global values. I think these would again be best solved with light util functions as the remix docs describe.
Another benefit of this approach is that the entire integration lives in a single route file.
HOW to test your changes?
Post-merge steps
Checklist