mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
added canonical link
This commit is contained in:
parent
464e1ae481
commit
0c492e3012
2 changed files with 9 additions and 2 deletions
|
@ -28,6 +28,10 @@ Template.layout.rendered = function(){
|
|||
link.href = Settings.get('faviconUrl', '/img/favicon.ico');
|
||||
document.getElementsByTagName('head')[0].appendChild(link);
|
||||
|
||||
// canonical
|
||||
var canonicalLink = document.createElement('link');
|
||||
canonicalLink.rel = 'canonical';
|
||||
document.getElementsByTagName('head')[0].appendChild(canonicalLink);
|
||||
};
|
||||
|
||||
Template.layout.events({
|
||||
|
|
|
@ -154,8 +154,11 @@ Posts.controllers.page = RouteController.extend({
|
|||
|
||||
onAfterAction: function () {
|
||||
var post = this.post();
|
||||
if (post && post.slug !== this.params.slug) {
|
||||
window.history.replaceState({}, "", post.getPageUrl());
|
||||
if (post) {
|
||||
if (post.slug !== this.params.slug) {
|
||||
window.history.replaceState({}, "", post.getPageUrl());
|
||||
}
|
||||
$('link[rel="canonical"]').attr("href", post.getPageUrl(true));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue