mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
af4bfb8862
- purely for cleanliness! - we use kebabcase by default - tests should be kebab-case-file_spec.js (one day we want this to be .test.js)
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;
|