Add trailing dots to page.description when longer than 300 characters

This commit is contained in:
Johan Preynat
2016-04-13 16:00:16 +02:00
parent 038cd0155b
commit ef2a24fe6f
+5 -1
View File
@@ -185,7 +185,11 @@ HTMLPipeline.prototype.applyAnnotations = function() {
// This can totally be improved
HTMLPipeline.prototype.extractDescription = function() {
var $p = this.$('p');
var description = $p.text().trim().slice(0, 300);
var description = $p.text().trim();
if (description.length > 300) {
description = description.slice(0, 300).trim()+'...';
}
this.opts.onDescription(description);
};