mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
🐛 Fixed custom excerpts sometimes being cut off (#19560)
refs TryGhost/Ghost#19559 - custom excerpts are truncated based on character length - escaped characters added extra length but we didn't account for this, resulting in poor truncation of excerpts
This commit is contained in:
parent
b15534690c
commit
40891272dc
@ -22,7 +22,7 @@ module.exports = function excerpt(options) {
|
||||
} else {
|
||||
excerptText = '';
|
||||
}
|
||||
|
||||
|
||||
excerptText = _.escape(excerptText);
|
||||
|
||||
truncateOptions = _.reduce(truncateOptions, (_truncateOptions, value, key) => {
|
||||
@ -32,8 +32,9 @@ module.exports = function excerpt(options) {
|
||||
return _truncateOptions;
|
||||
}, {});
|
||||
|
||||
// For custom excerpts, make sure we truncate them only based on length
|
||||
if (!_.isEmpty(this.custom_excerpt)) {
|
||||
truncateOptions.characters = this.custom_excerpt.length;
|
||||
truncateOptions.characters = excerptText.length; // length is expanded by use of escaped characters
|
||||
if (truncateOptions.words) {
|
||||
delete truncateOptions.words;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user