Ghost/core/server/data/meta/amp_url.js
kirrg001 4265afe580 Moved utils/url.js to UrlService
refs #9178

- we have to take care that we don't end up in circular dependencies
  - e.g. API requires UrlService and UrlService needs to require the API (for requesting data)
- update the references
- we would like to get rid of the utils folder, this is/was the most complicated change
2017-12-11 20:05:33 +01:00

15 lines
429 B
JavaScript

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