From d1427c8ba375076357a92d15f29bf4f7ce43fa84 Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 26 Nov 2018 06:32:49 -0800 Subject: [PATCH] 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 --- ghost/admin/app/components/gh-posts-list-item.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ghost/admin/app/components/gh-posts-list-item.js b/ghost/admin/app/components/gh-posts-list-item.js index fd01631432..d8a3390e82 100644 --- a/ghost/admin/app/components/gh-posts-list-item.js +++ b/ghost/admin/app/components/gh-posts-list-item.js @@ -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)}...`; }),