0

I have some redundant metadata tags in my <head> that I'm not sure I need, nor do I know if they are in the right order. I am using the gem "meta-tags"

<%= csrf_meta_tags %>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<%= display_meta_tags %>

Do I need both meta_tags elements and is where they're located okay/best-practice?

Jake
  • 1,086
  • 12
  • 38
  • https://stackoverflow.com/questions/26346917/why-use-x-ua-compatible-ie-edge-anymore – Maximillian Laumeister Oct 05 '18 at 23:54
  • 2
    I am guessing you are referring to `csrf_meta_tags` and `display_meta_tags`. They are completely different: `csrf_meta_tags` is a Rails helper to handle request forgery and `display_meta_tags` is a meta-tags gem helper to display SEO tags. Location is fine for both (the order of meta tags in `head` doesn't really matter) – AbM Oct 06 '18 at 00:04
  • @AbM Thanks, This is pretty interesting. I never knew they were completely different! Should I remove this question, or would you like to leave an official answer? – Jake Oct 06 '18 at 00:33
  • 1
    @AbM Quick note - the `charset` meta tag should be the very first meta tag in the head - the order does matter at least for that one tag. https://stackoverflow.com/questions/30682496/html5-meta-charset-before-title – Maximillian Laumeister Oct 06 '18 at 01:20
  • 1
    Thanks @MaximillianLaumeister, I added your comment in the answer below – AbM Oct 06 '18 at 13:45

1 Answers1

0

I am guessing you are referring to csrf_meta_tags and display_meta_tags. They are completely different:

Location is fine for both. The order of meta tags in head doesn't really matter, except for the charset meta tag that should be in the first position

AbM
  • 7,326
  • 2
  • 25
  • 28