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

Add custom attribute for meta tag #192

Open
kvandake opened this issue Feb 10, 2019 · 3 comments
Open

Add custom attribute for meta tag #192

kvandake opened this issue Feb 10, 2019 · 3 comments

Comments

@kvandake
Copy link

When I add Helmet to my React Application I have duplicates of the description tag.
To solve a duplicate, I need to add attribute data-react-helmet to the description tag.

For example

<meta name="description" content="some description" data-react-helmet="true">

Can I add this attribute?

@CongCong-1228
Copy link

Did you solve this problem, I don't think it's different from deleting

@EdgeCaseLord
Copy link

Adding custom attributes to the description tag and others, as in
config.title_tag_attributes = { id: 'page-title' }
would enable them to get updates via Turbo streams, too.

@bhtabor
Copy link

bhtabor commented Oct 11, 2024

Faced a similar issue with the refresh tag. Had to add data-turbo-track="reload" to avoid turbo interference with meta refresh. Previous page was refreshing even after navigating away. Here is a patch for that. Usage would be set_meta_tags refresh: { interval: 60, data: { turbo_track: 'reload' } }

module MetaTags
  module RendererPatch
    protected

    def render_refresh(tags)
      refresh = meta_tags.extract(:refresh)

      if refresh.present?
        interval = refresh[:interval].to_s
        data = refresh[:data] || {}

        tags << Tag.new(:meta, { "http-equiv" => "refresh", content: interval, data: })
      end
    end
  end
end

MetaTags::Renderer.prepend(MetaTags::RendererPatch)

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

No branches or pull requests

4 participants