Can meta tag description be declared dynamically in a web page - seo

I have a dynamic page, where the contents and title will change based on the parameters in the URL. I want the same to be done for meta tag description. As I don't have a sound knowledge of SEO, I don't know whether it will be valid or not.
Say suppose URL contains word "test"
I will do,
if("test" is present)
{
<title>test</test>
<meta decription="test"/>
}
else
{
<title>test1</test>
<meta decription="test1"/>
}
Can I do this? Does giving two meta tag descriptions for same page work.

It is best practice to have different, on the page content based values of the title element and the meta description for each web page. It is not forbidden by the the HTML5 specification to have multiple <meta name="description" content="YOUR DESCRIPTION"> elements but I would guess that search engines process only the first appearance of the element. So my recommendation would be use one <meta name="description" content="YOUR DESCRIPTION"> element for each page.

As long as you code it server-side (eg in PHP) when the page is generated rather than client-side (javascript) after the page has loaded, then it will be fine. That's how most CMS systems work already.
Done server-side, only one of the description tags will actually appear in the code Google see.
Done client-side, it is likely that they will see no description at all as I don't think many search engines render javascript.

Related

Can I put Open Graph tags out of the head tag of my page?

I am talking about the Open Graph tag here. Can I put the og meta tag anywhere on the page?
I want to use my detail page image for the og tag, the easiest solution is putting the og:image tag in the body of my page.
Open Graph meta tags should always be nested between <head> tags.
To turn your web pages into graph objects, you need to add basic
metadata to your page. We've based the initial version of the protocol
on RDFa which means that you'll place additional <meta> tags in the
<head> of your web page.
http://ogp.me/#metadata
Additionally, keep in mind that order of the tags matters, especially when dealing with array tags (which includes og:image).
Open Graph Tag should be always always be placed on header tag until knowledge goes.. People please correct me if I am wrong..

Google Plus Open Graph bug: G+ doesn't recognize open graph image when UTM or other query string appended to URL

Google Plus is pretty good at pulling images specified by Open Graph meta tags when standard URLs are shared like:
http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048
See:
But things start to get screwy when you start appending query strings, such as is done in this URL:
http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048?utm_source=google-plus&utm_medium=social&utm_campaign=stackoverflow-general-promotion
And for certain URLs + query strings the default image seems to make no sense at all:
http://skeptics.stackexchange.com/questions/4508/can-every-grain-of-sand-be-addressed-in-ipv6?xyz_12312313
The image featured in the above screengrab is the user pic of the guy who last left an answer to the shared question.
Is there any way to force Google Plus to fall back on images defined by og:image tags even when query strings are appended?
No, there is no way to fallback with Google+.
This behaviour is possible with Facebook scraper because it supports checking for og:url which Google+ does not support (Why???). These are the items Google+ supports
<meta property="og:title" content="..." />
<meta property="og:image" content="..." />
<meta property="og:description" content="..." />
Normally when query parameters are added if og:url is defined
Their recommended format is Schema as described at https://developers.google.com/+/web/snippet/
The order in which Google+ checks
Schema
Open Graph
Title and meta description tags
Guess???
Seeing that multiple Schema are defined on the pages you linked, according to the https://developers.google.com/+/web/snippet/ documentation, it should take the information from the itemscope defined nearest to the top
<body class="question-page new-topbar" itemscope itemtype="http://schema.org/QAPage">
which is a little funny/weird since their tool doesn't pick this up http://www.google.com/webmasters/tools/richsnippets?q=stackoverflow.com%2Fquestions%2F22342854%2Fwhat-is-the-optimal-algorithm-for-the-game-2048%3Futm_source%3Dgoogle-plus%26utm_medium%3Dsocial%26utm_campaign%3Dstackoverflow-general-promotion
So, then this brings us back to looking at your second image
The title is different as well, so og:title isn't being detected either. <title> is being scraped instead
What does this all mean?
Google plus sucks with markup for sharing.
You will need to adjust your top most Schema.org microdata and hope Google+ makes sense of it when adding params to the canonical url.
<body itemscope itemtype="http://schema.org/QAPage">
<h1 itemprop="name">Shiny Trinket</h1>
<img itemprop="image" src="{image-url}" />
<p itemprop="description">Shiny trinkets are shiny.</p>
</body>
Read this in the FAQ section for OpenGraph in Google+ :
Why isn't my +Snippet image appearing?
Images that are too small or not square enough are not included in the +Snippet, even if the images are explicitly referenced by schema.org microdata or Open Graph markup. Specifically, the height must be at least 120px, and if the width is less than 100px, then the aspect ratio must be no greater than 3.0.

Google plus snippet - Image thumbnail is not shown

Testing posting a snippet on Google+ with following HTML -
<!DOCTYPE html>
<head>
<meta property="og:image" content="http://i.imgur.com/le2WbeU.jpg" />
<meta itemprop="image" content="http://i.imgur.com/le2WbeU.jpg">
</head>
<body>
</body>
</html>
What I see is:
Looking at network traffic I see a failed request:
UPDATE: Looks like it was a caching problem. Once I appended a query string on to the URL, I got the image to pull up. I must have had a bad URL to an image the first time and it cached that bad URL request.
I don’t know if it causes the error, but you might want to use link instead of meta if the value is a URI.
The HTML5 spec defines that the meta element:
[…] represents various kinds of metadata that cannot be expressed using the […] link […] elements.
Microdata also explicitly requires it:
[…] the property must be specified using a URL property element
Also note that you don’t have created an item in your Microdata, so the image property is not defined (unless an item is created on the html start tag, which is missing in your example; or you reference it via itemref from the body).
Looks like it was a caching problem. Once I appended a query string on to the URL, I got the image to pull up. I must have had a bad URL to an image the first time and it cached that bad URL request.

How prevent indexing of contents of a page, not the page itself?

How can I make front-page and category pages of my CMS being indexed just by their meta description tag not by their contents (posts, navigation, ...)?
edit: Contents on these pages are generated dynamically and change frequently, so I want to prevent users don't find what they saw in search result summary
edit: Can nosnippet help for this or does it prevent the display of meta description content too?
Also How I can prevent indexing of contents of particular tag in a page?
Add this between your head tags:
<meta name="robots" content="noindex,nofollow"/>
But, Yandex does not care about this which is not respectful.

Prevent a div from Google being read and followed without JavaScript

I don't want some of divs on my page to be followed by Google because they contain duplicate content from other websites, is this possible that I prevent those divs to be 'no-followed'?
I have seen this:
Methods for preventing search engines from indexing irrelevant content on a page
but its suggesting JavaScript for this purpose and I can't use JS in my case, also that question is from 2009, I hope things are bit changed now?
If you really do not want use javascript for this, the only way I'm sure will stop Google for index some content of your page is using iframe + robots noindex/nofollow.
Instead of use a div, create a normal iframe, in a way that it appears that is not a iframe.
To page that is target of iframe, add metatag robots <meta name="robots" content="noindex, nofollow">
Keep in mind that it will probably be interpreted as if it were adversing, so there will be some penalty, but this penalty may be lower than copying significant amount of content.