mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
1bd8c18a16
* moved url-utils from server to shared * updated imports of url-utils
15 lines
418 B
JavaScript
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;
|