0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed post excerpt fallback in Stories list (#1052)

closes https://github.com/TryGhost/Ghost/issues/9775
- update the `subText` CP to prioritise the custom excerpt over meta description and plain text content
This commit is contained in:
Antonio 2018-11-26 06:32:49 -08:00 committed by Kevin Ansfield
parent 8ae47cd0e5
commit d1427c8ba3

View file

@ -31,15 +31,17 @@ export default Component.extend({
return authors.map(author => author.get('name') || author.get('email')).join(', ');
}),
// HACK: this is intentionally awful due to time constraints
// TODO: find a better way to get an excerpt! :)
subText: computed('post.{plaintext,metaDescription}', function () {
subText: computed('post.{plaintext,customExcerpt,metaDescription}', function () {
let text = this.get('post.plaintext') || '';
let customExcerpt = this.get('post.customExcerpt');
let metaDescription = this.get('post.metaDescription');
if (!isBlank(metaDescription)) {
if (!isBlank(customExcerpt)) {
text = customExcerpt;
} else if (!isBlank(metaDescription)) {
text = metaDescription;
}
return `${text.slice(0, 80)}...`;
}),