0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/data/meta/canonical_url.js
2016-09-20 15:59:34 +01:00

14 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;