Web pages accessible by multiple URLs for SEO reasons - redirect

I have a bunch of pages with the following structure:
<html>
<body>
<div id="summary">
</div>
<div id="promotions">
</div>
</body>
</html>
I want these pages to be accessible by both:
/items/one
/items/two
/items/three
And:
/promotional-offers/2014/february/one
/promotional-offers/2014/february/two
/promotional-offers/2014/february/three
/items/... should just open the page. /promotional-offers/2014/february/... should open the page /items/... and go to the anchor #promotions (scroll down to the appropriate div).
/items/one/#promotions
/items/two/#promotions
/items/three/#promotions
I'm not sure though how to set up rewrite rules in web.config to help search engines with indexing my pages and avoid having 'duplicate content'.

I would add a Canonical tag to completely avoid duplicate content, so It won't matter from which page you are showing the same content.
<!--url /promotional-offers/2014/february/one-->
<link rel="canonical" href="http://www.example.com/items/one" />

Related

I have a github webpage. How do I make a page displaying purely a pdf? I.e my cv?

I have a github webpage. How do I make a page displaying purely a pdf? I.e my cv?
To clarify, I wish the page to be filled only with the pdf - not any headings etc.
Just commit your pdf into your repo and it will be accessible just like any other file.
For instance, my resume is committed to my repo at https://github.com/xiongchiamiov/xiongchiamiov.github.com/blob/master/about/resume.pdf and is available on the web at https://changedmy.name/about/resume.pdf (I have a CNAME set up for changedmy.name).
Rather than redirecting to the PDF, you could embed it using an iframe or something like https://github.com/mozilla/pdf.js.
This way, the PDF will be accessible within the page and you could prevent it from being downloaded without viewing it in the browser.
It's not possible to make the page display "purely" the pdf, as to do that, you would need to alter the response headers, which obviously isn't possible with github pages.
You could have a JS redirect in your index.html that points to a pdf file that's also in your github-pages repo.
Suppose your file structure is like this:-
index.html
- cv(folder)
-----cv.pdf (your cv)
Then your code should look like this.
<html>
<body>
</body>
<script type="text/javascript">
document.location = "robin.github.io/cv/cv.pdf"
</script>
</html>
You can also do this:
<html lang="fr">
<head>
<!-- note the meta tag -->
<meta http-equiv="refresh" content="0; url=http://yourprofile.github.io/cv.pdf" />
<meta charset="utf-8">
<title>Will CV</title>
</head>
<body>
</body>
</html>
See Redirect from an HTML page for more info.
Github is using PDF.js to display PDFs, e.g. https://github.com/mozilla/pdf.js/blob/master/web/compressed.tracemonkey-pldi-09.pdf , you may find iframe with URL you can use to embed your resume (e.g. https://render.githubusercontent.com/view/pdf?commit=b261203018f847c89e05bb4c03c820fad0c90672&enc_url=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6d6f7a696c6c612f7064662e6a732f623236313230333031386638343763383965303562623463303363383230666164306339303637322f7765622f636f6d707265737365642e74726163656d6f6e6b65792d706c64692d30392e706466&nwo=mozilla%2Fpdf.js&path=web%2Fcompressed.tracemonkey-pldi-09.pdf&repository_id=1663468#13eff6e4-ecdb-4fe1-85e4-b7a468697e26)

Where to define schema.org itemtype for Article type: html, body, or div tag?

I have article pages where the only content on the page is the article. When marking up pages with schema.org microdata, is it best to define the itemscope and itemtype at the very top in the <html> tag? Or in the <body> tag? Or a <div> in the body? Or does it not matter?
Example of defining in <html> tag:
<html lang="en" itemscope itemtype="http://schema.org/Article">
<body>
<div>
<span itemprop="name">How to Tie a Reef Knot</span>
...
</div>
</body>
</html>
Versus a <div> in the body:
<html>
<body>
<div itemscope itemtype="http://schema.org/Article">
<span itemprop="name">How to Tie a Reef Knot</span>
...
</div>
</body>
</html>
Is one better than the other in terms of SEO? It seems like it would be best to define it as close to the top of the page as possible (ie, <html> tag) so the search engine spiders pick it up immediately.
If you inspect this very page, you will find that the html tag does indeed include schema.org metadata
<html itemscope="" itemtype="http://schema.org/QAPage">
Not everyone does this, but stackoverflow is a top 100 website- take that for what its worth.
Obviously, you will want schema.org metadata throughout the page as well.
Doesn't matter, in the sense that either will work and neither is "wrong". Where you put these things depends very much on what information's on your page, and how it's arranged (e.g., some schemas can't go inside certain other ones). However, though it's actually implied, you might want to put WebPage on the body element, be more specific from there on down through your page code.
There's absolutely no difference in terms of SEO, partly because it doesn't matter if the microdata is parsed a fraction of a microsecond earlier, and partly because only a few select bits of microdata are currently used by major search engines (of which Article isn't one), and Google have explicitly stated there's no effect on ranking (yet).
You need to put that on div tag as your article is enclosed under it at the lowest level..so when a search engine spider will crawl your page, it can more appropriately index your article content..
Although your pages contain only articles but still they may contain other portions such as menus, author information, etc.

301 redirect for site hosted at github?

Here's a Github repository of mine: https://github.com/n1k0/casperjs
There's a gh-pages branch to hold the project documentation, which is basically the project website: https://github.com/n1k0/casperjs/tree/gh-pages
This branch setups the documentation site at http://n1k0.github.com/casperjs/ — hurray.
In the meanwhile, I've bough the casperjs.org domain to get this website available through it, so I put a CNAME file as recommended in the docs: https://github.com/n1k0/casperjs/blob/gh-pages/CNAME — in their example, the operation is supposed to create redirects from www.example.com and charlie.github.com to example.com…
While the website now points to http://casperjs.org/, there's no 301 redirect from http://n1k0.github.com/casperjs/ (the old site url) to the new domain name.
Any idea how to setup such a redirect, if it's even possible? Is it a bug? If it is, where should I open an issue?
Bringing this topic back from the dead to mention that GH now supports redirect-from's redirect-to parameter https://github.com/jekyll/jekyll-redirect-from#redirect-to
Simply add this to your _config.yml
gems:
- jekyll-redirect-from
And this to the top of your index page.
---
redirect_to: "http://example.com"
---
To avoid the duplicate content, in a first time you can add a meta canonical like this:
<link rel="canonical" href="http://casperjs.org">
You can redirect using Javascript after host detection, like this:
if (window.location.href.indexOf('http://niko.github.com') === 0) {
window.location.href = 'http://casperjs.org{{ page.url }}';
}
But I agree, it's not an HTTP redirection.
Why didn't you use http://www.w3.org/TR/WCAG20-TECHS/H76.html?
That would give
<meta http-equiv="refresh" content="0;URL='http://casperjs.org/'" />
Github pages don't support anything like .htaccess or nginx/conf
https://help.github.com/articles/redirects-on-github-pages/
so easiest way is:
HTML redirect:
index.html
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://www.mywebsite.com/" />
</head>
<body>
<p>Redirect</p>
</body>
</html>
Manual layout method
If you don't feel like using https://github.com/jekyll/jekyll-redirect-from it's easy to implement it yourself:
a.md:
---
layout: 'redirect'
permalink: /a
redir_to: 'http://example.com'
sitemap: false
---
_layouts/redirect.html based on Redirect from an HTML page :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
{% comment %}
Don't use 'redirect_to' to avoid conflict
with the page redirection plugin: if that is defined
it takes over.
{% endcomment %}
<link rel="canonical" href="{{ page.redir_to }}"/>
<meta http-equiv="refresh" content="0;url={{ page.redir_to }}" />
</head>
<body>
<h1>Redirecting...</h1>
<a href="{{ page.redir_to }}">Click here if you are not redirected.<a>
<script>location='{{ page.redir_to }}'</script>
</body>
</html>
Now:
firefox localhost:4000/a
will redirect you to example.com.
Like this example, the redirect-from plugin does not generate 301s, only meta + JavaScript redirects.
We can verify what is going on with:
curl localhost:4000/a
Tested on GitHub pages v64, live demo at: https://github.com/cirosantilli/cirosantilli.github.io/tree/d783cc70a2e5c4d4dfdb1a36d518d5125071e236/r
No.
Other answers talk about redirections with meta refresh or javascript. But the OP asked about 301 redirects. And here's the answer: No. It is not possible. Your site on GitHub Pages is static, so you don't have any control over the server.
I had a similar issue when switching the domain for my github pages site. I set up rerouter on Heroku to handle the 301 redirects to the new domain. It handles domain-to-domain redirects very simply, but you may have to modify it to handle your site's legacy domain+path location.
I described the steps in detail here:
http://joey.aghion.com/simple-301-redirects/

Where should one place the meta tags to embed the Facebook Comments plugin?

I would like to embed the Facebook Comments plugin on my site.
Where should I place the meta tags in order to add moderators for the comment box?
I've tried merging the tags with the div and placing it between the div like this, but with no results:
<div class="fb-comments" data-href="http://example.com meta property="fb:admins" content="{12345678901234567890}"/" data-num-posts="1" data-width="600"></div>
<div class="fb-comments" data-href="http://example.com <meta property="fb:admins" content="{12345678901234567890}"/>" data-num-posts="1" data-width="600"></div>
<div class="fb-comments" data-href="http://example.com" data-num-posts="1" data-width="600"><meta property="fb:admins" content="{12345678901234567890}"/></div>
The comment box does work without the meta tags, though without the moderator support of course.
If it matters, my site is published on webs.com.
The meta does not go in the plug-in code. The meta tags go into the HTML of the site located at the data-href's URL. It is placed in the page's <HEAD> section.

Facebook URL Linter incorrectly throwing error on Microdata markup

The Facebook URL Linter now throws errors when it sees tags outside of the head. The problem is that these tags are used for Microdata markup.
So in my HTML, in the body, I'll have tags equivalent to:
<meta itemprop="ratingValue" content="5"/>
It's required to be in the <body> since it needs to be encapsulated within my <DIV> where I'm specifying the necessary itemprop value. ie:
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
...
<meta itemprop="ratingValue" content="5"/>
</div>
The Facebook URL linter never threw errors on this when I first implemented microdata markup but when I did a check on one of our pages today, the error shown was:
Body Meta: You have <meta> tags ouside of your <head>. This is either because your <head> was malformed and they fell lower in the parse tree, or you accidentally put your Open Graph tags in the wrong place. Either way you need to fix it before the tags are usable.
I did a double check on Google's documentation on Microdata and it has a code example that also has a META tag that must be outside the head since it's nested within a <DIV>:
<div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">
Rating: <span itemprop="value">8.5</span>
<meta itemprop="best" content="10" />
</div>
Anyone else having this problem too?