add canonical tag

This commit is contained in:
Henning Peters 2015-12-03 16:26:51 +01:00
parent 6e6a8f5c07
commit 79ff34c213
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ include ./header
include ./mixins.jade
- var Page = InitPage(Site, Authors.spacy, "home", '404')
- Page.canonical_url = null
- Page.is_error = true
- Site.slogan = "404"
- Page.active = {}

View File

@ -28,8 +28,10 @@
- Page.links = [];
- if (type == "home") {
- Page.url = "";
- Page.canonical_url = Site.url + Page.url;
- } else {
- Page.url = "/" + type;
- Page.canonical_url = Site.url + Page.url.replace(/\/?$/, '/');
- }
-
- // Set defaults
@ -57,6 +59,7 @@
- Page.description = Meta.description
- Page.date = Meta.date
- Page.url = Meta.url
- Page.canonical_url = Site.url + Page.url.replace(/\/?$/, '/');
- Page.active["blog"] = true
- Page.links = Meta.links
- if (Meta.image != null) {
@ -98,6 +101,8 @@ mixin WritePage(Site, Author, Page)
meta(property="og:site_name" content=Site.name)
meta(property="article:published_time" content=getDate(Page.date).timestamp)
link(rel="stylesheet" href="/resources/css/style.css")
if Page.canonical_url
link(rel="canonical" href=Page.canonical_url)
//[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]