I have the following two meta tags on my website
<meta name="author" content="#vanntile" />
<meta name="twitter:creator" content="#vanntile" />
I know that I cannot use two name atributes in the same meta tag, like this:
<meta name="author" name="twitter:creator" content="#vanntile" />
My question is, is the following meta valid?
<meta name="author,twitter:creator" content="#vanntile" />
According to the HTML5 Standard, the a meta element with a name attribute expresses a single metadata name-value pair, and the name attribute contains the name part of the pair.
While the code you suggested is not invalid, it will mean the metadata pair ("author,twitter:creator" : "#vanntile"), not both ("author" : "#vanntile") and ("twitter:creator" : "#vanntile").
Related
I just realized I have two meta tags in my HTML head:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
Do both work when there are multiple? Should I merge them? Is it just as good with having multiple meta-tags?
Have a look at the definition of the meta element. It says:
Exactly one of the name, http-equiv, and charset, attributes must be specified.
So your two example meta elements couldn’t possibly be merged, because then the meta element would have the charset and the name attribute, which is not allowed.
It is completely normal to have multiple meta tags, also you can't merge them according to the answer of unor.
I am trying to include extracted structured data in my webpages.
I included this for description:
<meta itemprop="description" content="my description" />
However I realised that there is already a normal meta description on the page:
<meta name="description" content="my description" />
Is it ok to leave both of them or it is really necessary to merge them together maybe like:
<meta itemprop="description" name="description" content="" />
You should leave both of them. The Microdata Spec says:
If a meta element has an itemprop attribute, the name, http-equiv, and
charset attributes must be omitted, and the content attribute must be
present.
so it would be invalid to merge them.
I have a company web page that I've added a Facebook 'Like' button too. I have defined the namespace for FB and OG and added in all my Metatags - my code is below. URL is www.akascia.com.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" xmlns:og="http://ogp.me/ns#">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="og:title" content="Akascia" />
<meta property="og:type" content="company" />
<meta property="og:url" content="http://www.akascia.com" />
<meta property="og:image" content="http://www.akascia.com/images/akascia_fb_logo.png" />
<meta property="og:site_name" content="Executive search, purely done by Akascia" />
<meta property="fb:admins" content="********" />
<meta property="fb:page_id" content="**********" />
<meta property="og:email" content="admin#akascia.com"/>
<meta property="og:phone_number" content="+44 2070 787 665"/>
However, when I run the site through the Facebook linter, I get the following results:
Warnings that should be fixed
Extraneous Property: Objects of this type do not allow properties named fb:page_id.
Extraneous Property: Objects of this type do not allow properties named og:email.
Extraneous Property: Objects of this type do not allow properties named og:phone_number.
Open Graph Object Properties
fb:admins Array of length 1
⍾ ********
og:url http://www.akascia.com/
og:type website
og:title Akascia
og:image
og:site_name Executive search, purely done by Akascia
og:updated_time 1320835017
Raw Open Graph Document Information
Canonical URL http://www.akascia.com/
Meta Tag <meta property="og:title" content="Akascia" />
Meta Tag <meta property="og:type" content="company" />
Meta Tag <meta property="og:url" content="http://www.akascia.com" />
Meta Tag <meta property="og:image" content="http://www.akascia.com/images/akascia_fb_logo.png" />
Meta Tag <meta property="og:site_name" content="Executive search, purely done by Akascia" />
Meta Tag <meta property="fb:admins" content="731575475" />
Meta Tag <meta property="fb:page_id" content="114216411121" />
Meta Tag <meta property="og:email" content="admin#akascia.com" />
Meta Tag <meta property="og:phone_number" content="+44 2070 787 665" />
So it seems that it thinks the webpage should have the og:type:webpage, even though I'm declaring as a 'company' and in the raw data it's showing it's scraped it as 'company' too. Hence it's giving the warnings for the telephone numbers etc.
The 'Like' button seems to work but I'm not 100% sure it's right. So I'm a bit confused as to why this is happening.
The current list of builtin object types is listed here: http://developers.facebook.com/docs/beta/opengraph/objects/builtin/
Company isn't in the list. Website is the default that it's falling back to, and if you scroll down the page to where it has an example for a Website Object type, you can see it doesn't list support for all your properties, hence the Extraneous Property warnings.
You can create your own object type, though, that supports any properties you want. Create a Facebook Application, and go to the "Open Graph" section. You can create an action and an object type (such as, perhaps "like" a "company"), and then go to the "Open Graph/Dashboard" to add custom properties to your "company" object type. One type of custom property is a ContactInfo that would include your phone number and such; or you could just add a few string properties that are exactly what you need. You can then click "Get Code" to copy the new set of meta tags to use on your page.
This walkthrough probably describes the process better: https://developers.facebook.com/docs/customopengraph/walkthrough/
But really, after all that, if you're happy with how it is showing up on peoples' feed when they "Like" your page, then it is probably fine the way it is. You could add an og:description tag with any extra info you want in there, and just delete the extraneous tags.
old og:type like company, product ... are deprecated. They are not included in the current OpenGraph specification.
Very few og:type are still available (website, article, video....).
If you really want to use the og:type company, you will have to declare it in your own opengraph namespace.
CF : http://ogp.me/ , http://graph.facebook.com/schema/og/ and http://developers.facebook.com/docs/beta/opengraph/objects/builtin/
(the last link was first added by Melinda Weathers)
For the fb:admin tag, try putting in a personal profile's link.
i.e. your facebook page has a profile associated with it which is an admin to the page- the ID for the profile should work.
I need to specify multiple copyrights or authors using the <meta> tag. Can I use a <meta> tag with the same name multiple times?
<meta name="copyright" content="Company A" />
<meta name="copyright" content="Company B" />
Will the search engine respect both values? Or, do I need to comma-separate them in one <meta> tag?
Thanks.
Using multiple meta tags with the same name is valid HTML.
But we don't know how search engines and other readers will interpret them. Either two meta tags will be concatenated or one of them will be ignored/overwritten.
Example: The PHP-function get_meta_tags() will ignore multiple meta tags with an equal name.
To avoid possible problems I would recommend to use a single meta tag:
<meta name="copyright" content="Company A, Company B" />
If the page contains multiple meta tags of the same type, Google will aggregate the content values. For instance, they will interpret
<META NAME="ROBOTS" CONTENT="NOINDEX">
<META NAME="ROBOTS" CONTENT="NOFOLLOW">
The same way as:
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
More details here:http://googlewebmastercentral.blogspot.ro/2007/03/using-robots-meta-tag.html
I guess most other search engines would handle the meta tags in the same way.
Is it possible to combine the meta description and Open Graph Protocol description…
<meta name="description" content="My meta description copy." />
<meta property="og:description" content="My meta description copy." />
…into one when they contain the same content?
<meta name="description" property="og:description" content="My meta description copy." />
Yes, you can combine them. To test it, I made the simple HTML page below, uploaded it to a server, then ran the page through Facebook's URL Linter. It reported no warnings related to the description tag (only about the missing og:image tag) and correctly read the description.
<!doctype html>
<html>
<head>
<meta name="description" property="og:description" content="My meta description copy." />
<meta property="og:title" content="Test page" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://example.com/ogtest.html" />
</head>
<body>
Test
</body>
</html>
Note that, if the og:url value is different to the current page url, Facebook will look for a description on that url instead of the current one and ignore the current page's description tag.
It might also interest you to know that, even though it's possible to combine the two description tags, Facebook doesn't do this on their own website.
Some additional info on why this is possible/allowed:
HTML+RDFa 1.1 extends HTML5’s meta element.
HTML+RDFa 1.1 (W3C Recommendation) defines:
If the RDFa #property attribute is present on the meta element,
neither the #name, #http-equiv, nor #charset attributes are required
and the #content attribute MUST be specified.
So when using RDFa's #property the name is not required but it is not forbidden either, making
<meta name="description" property="og:description" content="great description">
perfectly ok according to spec.
I found this from the answer to this related question: Is it possible to use the same meta tag for opengraph and schema.org