Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
some analyzing tools say, that the meta tag "language" is important and suggest to fix on a website, which is missing it.
Something like that: <meta name="language" content="de,de-at,de-ch" />
Is there a reason that this meta tag is not available? If not, I would like to request it's addition.
Comment | File | Size | Author |
---|---|---|---|
#29 | metatag-content-language-1338612-28.patch | 1.05 KB | Michsk |
#28 | metatag-content-language-1338612-27.patch | 1.05 KB | Michsk |
#24 | metatag-content-language-1338612-24.patch | 2.06 KB | Michsk |
#21 | metatag-content-language-1338612-20.patch | 2.92 KB | Michsk |
#18 | metatag-content-language-1338612-18.patch | 2.05 KB | Michsk |
Comments
Comment #1
akcakaya CreditAttribution: akcakaya commentedHello,
I need language meta tag for SEO in my website. How can i add Language meta tag?
Regards,
Comment #2
marcoka CreditAttribution: marcoka commented+1, even if i have the opinion that google ignores this and analyzes the text (text analyze shows it the language). other opinions?
Comment #3
colanFeature requests go into HEAD.
Comment #4
DamienMcKennaComment #5
Sinan Erdem CreditAttribution: Sinan Erdem commentedAny progress on this?
Comment #6
Rar9 CreditAttribution: Rar9 commentedis this now in beta 5?
Comment #7
DamienMcKennaComment #8
giannisr CreditAttribution: giannisr commentedAny progress or solution on this?
Comment #9
aschiwi CreditAttribution: aschiwi commentedFrom this issue I assume this is not being worked on. So as usual, patches are welcome.
Comment #10
Michsk CreditAttribution: Michsk commentedCreate a custom module (i called mine metatag_hacks) and add the following snippet in your module.module. It implements
hook_metatag_info()
.Comment #11
DamienMcKenna@lasac: Or you could make a patch..
Comment #12
Michsk CreditAttribution: Michsk commentedWill do. Just saw that the snippet is not correct we need
http-equiv=''
and notname=''
.Comment #13
Michsk CreditAttribution: Michsk commentedHere is the patch.
Comment #14
Michsk CreditAttribution: Michsk commentedlooks like the tabs are not converted to spaces. In drupal we use 2 or 4 spaces for a tab?
Comment #15
Michsk CreditAttribution: Michsk commentedIndents should be fixed.
Comment #16
Michsk CreditAttribution: Michsk commentedguess not
Comment #17
Michsk CreditAttribution: Michsk commentedAnd now...
Comment #18
Michsk CreditAttribution: Michsk commentedLast time.
Comment #19
Michsk CreditAttribution: Michsk commentedas a sidenote i would advice the following patch for this as well:
https://drupal.org/node/975116
This gives you language tokens.
Comment #20
DamienMcKennaThanks for putting the effort into this patch, I'll review it later today.
BTW when you upload a patch you need to change the status to "Needs review" as that both triggers the automated test system and informs others that it's ready to be manually tested & reviewed too.
Comment #21
Michsk CreditAttribution: Michsk commentedGot it. Here is the final patch, others should be forgotton.
Comment #23
DamienMcKennaThere's one small thing that needs to be fixed - you have some hard tabs at the closing line of the $element definition.
Comment #24
Michsk CreditAttribution: Michsk commentedNew patch.
Comment #25
Michsk CreditAttribution: Michsk commentedI must say tough that my hands are itching when i see
metatag.inc
. We really should have the new objects just define a different template in stead of copy-pasting the wholegetElement()
method.If i can find the time i would like to have a look at refactoring the code a bit if you like.
Comment #26
DamienMcKennaComment #27
DamienMcKenna@Lasac: I'm always interested in seeing how others can help improve the module :)
Comment #28
Michsk CreditAttribution: Michsk commentedGlad this hasn't been committed yet. After taking a better look at the code the following patch will do all we need without creating a whole new object.
Comment #29
Michsk CreditAttribution: Michsk commentedWoops
Comment #29.0
Michsk CreditAttribution: Michsk commentedexample wasn't visible, so surrounded it by the code-tags.
Comment #30
JordanMagnuson CreditAttribution: JordanMagnuson commentedFYI, missing meta language information is reported as a "Moderate" SEO compliance issue by Bing webmaster tools.
Comment #31
rondev CreditAttribution: rondev commentedI tested it with #975116: Create a 'language' token type (D7) to get a token.
Seems OK.
I use [language:language-content] for content language in the Global section of Metatag.
Comment #32
DamienMcKennaThis needs a description added to explain what the meta tag is for and what acceptable values are.
Comment #33
aprohl5 CreditAttribution: aprohl5 commentedI went to add the description field for the "language-content" meta tag and, after reading the w3 documentation on the tag ( http://www.w3.org/International/questions/qa-http-and-lang ) learned that this tag is deprecated and should not be used. As an alternative, you should include the "lang" attribute in the tag, drupal 7 does this already on both translated and non translated sites. If you would like I can still make the fix to the description field on the patch.
Comment #34
aprohl5 CreditAttribution: aprohl5 commentedComment #35
aprohl5 CreditAttribution: aprohl5 commentedComment #36
DamienMcKennaCommitted. Thanks everyone!
Comment #38
DamienMcKennaComment #40
selinav CreditAttribution: selinav commentedExcuse-me I have update with the RC2 version and I don't see the meta content language in my content pages.
Where should I set this ?
Comment #41
selinav CreditAttribution: selinav commentedHello after update to the 7x-1.5, the meta content language still doesn't display,
I've entered on the admin/config/search/metatags (Global) page the field
Content language= [metatag:content-language]
But on the source code, it doesn't appears.
What is the mistake ?
Best regards
Comment #42
DamienMcKennaAny time you use a "metatag" token in a metatag that means that you want it to use another meta tag value in place of the current one, e.g. using [metatag:description] in og:description. You should be using [node:language] to display a node's language, or apply the patch from #975116: Create a 'language' token type (D7) to add a new token to show the current page's language.
Also, the fact that you're using [metatag:content-language] in the "content language" tag means that you're created a circular reference; this would have crashed older versions but 1.5 is able to identify these (to a degree) and now blow up your site :)
Comment #43
selinav CreditAttribution: selinav commentedDamienMcKenna, thanks for the reply. I did not understand it is a circular reference.
If I use [node:language] it well works for node.
What is the token to use for the homepage ([current-page:query:?], views or taxonomy ?
Thanks in advance
Comment #44
DamienMcKenna@selinav: You need to use the patch from #975116: Create a 'language' token type (D7), then you'll have a new token for the current language that could be used in the global settings.