mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
16f5d1fdaf
refs #7488 - to be able to refactor the url configuration in ghost, we need to go step by step making this possible - reduce the usage of forceAdminSSL - add a urlFor('admin') helper, which returns the admin url + path e.g. http://my-blog.com/blog/ghost - increase usage of urlFor helper - do not expose getBaseUrl, use urlFor('home') (home === blog)
15 lines
326 B
JavaScript
15 lines
326 B
JavaScript
var utils = require('../../utils'),
|
|
getUrl = require('./url');
|
|
|
|
function getCanonicalUrl(data) {
|
|
var url = utils.url.urlJoin(utils.url.urlFor('home', true), getUrl(data, false));
|
|
|
|
if (url.indexOf('/amp/')) {
|
|
url = url.replace(/\/amp\/$/i, '/');
|
|
}
|
|
|
|
return url;
|
|
}
|
|
|
|
module.exports = getCanonicalUrl;
|