Ghost/core/frontend/meta/amp_url.js
Vikas Potluri 1bd8c18a16
Moved core/server/lib/url-utils to core/shared/url-utils (#11856)
* moved url-utils from server to shared
* updated imports of url-utils
2020-05-28 11:57:02 +01:00

15 lines
418 B
JavaScript

const urlUtils = require('../../shared/url-utils');
const getUrl = require('./url');
const _ = require('lodash');
function getAmplUrl(data) {
const context = data.context ? data.context : null;
if (_.includes(context, 'post') && !_.includes(context, 'amp')) {
return urlUtils.urlJoin(urlUtils.urlFor('home', true), getUrl(data, false), 'amp/');
}
return null;
}
module.exports = getAmplUrl;