Closed AxelTheGerman closed 2 years ago
Technically, your particular use-case can be implemented using canonical
link:
display_meta_tags(canonical: 'https://google.com', og: { url: :canonical })
# <link rel="canonical" href="https://google.com">
# <meta property="og:url" content="https://google.com">
The idea is interesting, but the implementation introduces an inconsistency in the library.
When I call set_meta_tags(something: 'something-else')
, I expect a meta tag <meta name="something" content="something-else">
(see Custom meta tags. After the change, the tag will be "consumed" by a nested custom meta tag (aka "og:url") - only because the hashes are processed before non-nested tags (which is an implementation detail, and can change at any moment).
@kpumuk thanks for taking the time to point me to the right solution! (And that my implementation actually "consumes" the tag)
And thanks for this great library!
Besides only checking the normalized meta tags for mirrored values we can also check the plain
meta_tags
attribute. This supports, e.g. setting theog:url
meta tag to the value of thecanonical_link
meta tag.Let me know what you think - I came across this today as I was trying to achieve exactly this, setting the
og:url
to thecanonical_link
as I was already setting that.