Ghost/core/server/data/meta/canonical_url.js
Katharina Irrgang 16f5d1fdaf 🎨 add urlFor('admin') and increase usage of urlFor helper (#7935)
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)
2017-02-02 18:51:35 +00:00

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;