Skip to content

Instantly share code, notes, and snippets.

@paimoe
Created September 23, 2011 06:24
Show Gist options
  • Save paimoe/1236851 to your computer and use it in GitHub Desktop.
Save paimoe/1236851 to your computer and use it in GitHub Desktop.
Canonical Blogger redirects, should imitate a 301 redirect from blogger
<head>
<title><$BlogPageTitle$></title>
<Blogger><ItemPage><link rel="canonical" href="http://www.example.com/index/reverse_g/?s=<$BlogItemPermalinkURL$>" /></ItemPage></Blogger>
<MainPage><link rel="canonical" href="http://www.example.com/" /></MainPage>
<Blogger><ArchivePage><link rel="canonical" href="http://www.example.com/index/reverse_g/?s=/<$BlogItemArchiveFilename$>" /></ArchivePage></Blogger>
<script type="text/javascript">
rd_path = window.location.pathname + window.location.search
rd_next_path = 'http://www.example.com/index/reverse' + rd_path; // Gives example.com/index/reverse/2011/07/post-title.html
<Blogger><ItemPage>window.location.href = rd_next_path</ItemPage></Blogger>
<MainOrArchivePage>window.location.href = rd_next_path</MainOrArchivePage>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment