Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excerpt not pulling entire HTML entity #21955

Open
1 task done
brandishwar opened this issue Dec 30, 2024 · 1 comment
Open
1 task done

Excerpt not pulling entire HTML entity #21955

brandishwar opened this issue Dec 30, 2024 · 1 comment
Labels

Comments

@brandishwar
Copy link

Issue Summary

The Dope theme is coded to output an excerpt limited to 33 words. I have a post which includes an "'s" on the 33rd word. When Ghost is generating the excerpt for that post to display in a tag feed (or author feed), the last word has a stray ampersand (&) instead of including the full "'s" - e.g., "it&" instead of "it's".

With the Dope theme as coded, the issue can be reproduced with this text as the body of the post:

one two three four five six seven eight nine ten one two three four five six seven eight nine ten one two three four five six seven eight nine ten one two three's four

Since this is a bug in the excerpt helper and not Dope, this should be easily reproducible by moving the "'s" in the above text block to whatever word limit is specified for a theme. Screenshot of the issue:

excerpt_bug

Steps to Reproduce

  1. Identify or modify a theme so a word limit is passed into the excerpt helper
  2. Create or identify a post with a body exceeding the word limit.
  3. For the word at the word limit identified in step 1, add "'s" to the end of the word - e.g., if the theme is configured to cut off the excerpt at 33 words, add "'s" to the 33rd word.
  4. Save the post
  5. Navigate to a feed that will display the post and locate the post excerpt

Ghost Version

5.105.0

Node.js Version

20.18.1

How did you install Ghost?

VirtualBox VM running Linux Mint 22

Database type

MySQL 8

Browser & OS version

No response

Relevant log / error output

No response

Code of Conduct

  • I agree to be friendly and polite to people in this repository
@github-actions github-actions bot added the needs:triage [triage] this needs to be triaged by the Ghost team label Dec 30, 2024
@vershwal
Copy link
Member

vershwal commented Jan 7, 2025

Hello @brandishwar, thank you for reporting this issue. I’ve been able to reproduce it on the Dope theme using the steps you provided.

The Dope theme uses {{excerpt words="33"}}

There seems to be a bug in our excerpt helper, where we escape the excerpt first (it's becomes it's) and then truncate it based on the words or characters option (code).

I’m marking this as a bug. Would love a PR for this if you’re interested in working on a fix 🙏

@vershwal vershwal added P4 - Low and removed needs:triage [triage] this needs to be triaged by the Ghost team labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants