0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00
ghost/core/server/data/meta/rss_url.js
kirrg001 8a10826518 Protected error if routes.yaml file doesn't contain any collections
no issue

- if you define no collections, but a static route, it can happen that the target template to render
  makes use of the {{ghost_head}} helper
- the {{ghost_head}} helper tries to create the primary rss feed url
- at the moment: no collections, no primary rss feed url
- if we offer the option to define custom rss rules, this function might need an extension
2018-06-13 21:01:05 +02:00

24 lines
648 B
JavaScript

const routingService = require('../../services/routing');
/**
* https://github.com/TryGhost/Team/issues/65#issuecomment-393622816
*
* For now we output only the default rss feed link. And this is the first collection.
* If the first collection has rss disabled, we output nothing.
*
* @TODO: We are currently investigating this.
*/
function getRssUrl(data, absolute) {
const firstCollection = routingService.registry.getFirstCollectionRouter();
if (!firstCollection) {
return null;
}
return firstCollection.getRssUrl({
secure: data.secure,
absolute: absolute
});
}
module.exports = getRssUrl;