Ghost/core/server/data/meta/canonical_url.js
2016-09-20 15:59:34 +01:00

15 lines
330 B
JavaScript

var utils = require('../../utils'),
getUrl = require('./url');
function getCanonicalUrl(data) {
var url = utils.url.urlJoin(utils.url.getBaseUrl(false),
getUrl(data, false));
if (url.indexOf('/amp/')) {
url = url.replace(/\/amp\/$/i, '/');
}
return url;
}
module.exports = getCanonicalUrl;