mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05: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
5a630b6aa4
commit
f9adc59774
1 changed files with 3 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue