0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core/frontend/meta/generate-excerpt.js
2022-05-16 15:51:14 +01:00

14 lines
380 B
JavaScript

const downsize = require('downsize');
function generateExcerpt(excerpt, truncateOptions) {
truncateOptions = truncateOptions || {};
if (!truncateOptions.words && !truncateOptions.characters) {
truncateOptions.words = 50;
}
// Just uses downsize to truncate, not format
return downsize(excerpt, truncateOptions);
}
module.exports = generateExcerpt;