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.

Files: 
CommentFileSizeAuthor
#29 metatag-content-language-1338612-28.patch1.05 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#28 metatag-content-language-1338612-27.patch1.05 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#24 metatag-content-language-1338612-24.patch2.06 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#21 metatag-content-language-1338612-20.patch2.92 KBLasac
FAILED: [[SimpleTest]]: [MySQL] 45 pass(es), 42 fail(s), and 2 exception(s).
[ View ]
#18 metatag-content-language-1338612-18.patch2.05 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#17 metatag-content-language-1338612-17.patch2.02 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#15 metatag-content-language-1338612-15.patch2.02 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]
#13 metatag-content-language-1338612-13.patch2.03 KBLasac
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Comments

Hello,

I need language meta tag for SEO in my website. How can i add Language meta tag?

Regards,

+1, even if i have the opinion that google ignores this and analyzes the text (text analyze shows it the language). other opinions?

Version:7.x-1.0-alpha1» 7.x-1.x-dev

Feature requests go into HEAD.

Component:User interface» Code

Any progress on this?

is this now in beta 5?

Component:Code» Other tags

Any progress or solution on this?

From this issue I assume this is not being worked on. So as usual, patches are welcome.

Create a custom module (i called mine metatag_hacks) and add the following snippet in your module.module. It implements hook_metatag_info().

<?php
function metatag_hacks_metatag_info() {
    $info = array();
    $info['tags']['language'] = array(
        'label' => t('Language'),
        'description' => '',
        'class' => 'DrupalTextMetaTag',
        'group' => 'advanced',
    );
    return $info;
}

@lasac: Or you could make a patch..

Will do. Just saw that the snippet is not correct we need http-equiv='' and not name=''.

StatusFileSize
new2.03 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Here is the patch.

looks like the tabs are not converted to spaces. In drupal we use 2 or 4 spaces for a tab?

StatusFileSize
new2.02 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Indents should be fixed.

guess not

StatusFileSize
new2.02 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

And now...

StatusFileSize
new2.05 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Last time.

as a sidenote i would advice the following patch for this as well:
https://drupal.org/node/975116

This gives you language tokens.

Status:Active» Needs review

Thanks 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.

StatusFileSize
new2.92 KB
FAILED: [[SimpleTest]]: [MySQL] 45 pass(es), 42 fail(s), and 2 exception(s).
[ View ]

Got it. Here is the final patch, others should be forgotton.

Status:Needs review» Needs work

The last submitted patch, metatag-content-language-1338612-20.patch, failed testing.

There's one small thing that needs to be fixed - you have some hard tabs at the closing line of the $element definition.

StatusFileSize
new2.06 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

New patch.

I 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 whole getElement() method.

If i can find the time i would like to have a look at refactoring the code a bit if you like.

Status:Needs work» Needs review

@Lasac: I'm always interested in seeing how others can help improve the module :)

StatusFileSize
new1.05 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Glad 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.

StatusFileSize
new1.05 KB
PASSED: [[SimpleTest]]: [MySQL] 73 pass(es).
[ View ]

Woops

Issue summary:View changes

example wasn't visible, so surrounded it by the code-tags.

FYI, missing meta language information is reported as a "Moderate" SEO compliance issue by Bing webmaster tools.

I tested it with #975116: Create a 'language' token type to get a token.
Seems OK.
I use [language:language-content] for content language in the Global section of Metatag.

Issue summary:View changes
Status:Needs review» Needs work

This needs a description added to explain what the meta tag is for and what acceptable values are.

I 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.

Status:Needs work» Needs review

Assigned:Unassigned» aprohl5