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

{{content words}} error with CTA #22095

Open
1 task done
cathysarisky opened this issue Jan 31, 2025 · 0 comments
Open
1 task done

{{content words}} error with CTA #22095

cathysarisky opened this issue Jan 31, 2025 · 0 comments
Labels
needs:triage [triage] this needs to be triaged by the Ghost team

Comments

@cathysarisky
Copy link
Contributor

cathysarisky commented Jan 31, 2025

Issue Summary

Using {{content words="10"}} should probably return 10 words whenever possible. Things get messy if there's no access to the post. [Aside: it's also possible to pass 'characters' and that has exactly the same problems.]

Background: Some themes use the {{content}} helper with words to generate a short preview, for example for an index page.

Steps to Reproduce

Here's the behavior that can occur when the helper is used with words=10 . In my post.hbs, I've added
{{content words="10"}}

Create a post in the editor. Make it 20 words. long.
Expected: See the first 10 words. Actual: First 10 words.

Set post access to members only (don't be a member).
Expected: ? Not sure, honestly? Actual: Entire CTA. This generally breaks the layout, although the theme can avoid it by checking for access before using {{content}}.

Add a public preview line after 20 words. Add some more words after it.
Expected: 10 words. Actual: All 20 words, PLUS the CTA. I can use {{{html}} instead, but it doesn't take a words argument.

Proposal & ideas

If the public preview is longer than the words value, return only the words, no CTA. [We certainly shouldn't return more words than requested.]
If the public preview is longer than the words, truncate it at the listed words, followed by the CTA.
If there is no public preview, then... ?

Would it make sense to add a "noCTA" option that causes {{content}} to write out the smaller of "words" or the public preview if words is set, or the public preview (minus CTA) if words is set, or nothing if there's no preview?

Ghost Version

5.109

Node.js Version

pro, or 20.

How did you install Ghost?

pro, or source code build, or ghost-cli.

Database type

MySQL 8 or SqLite.

Browser & OS version

doesn't matter.

Relevant log / error output

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 Jan 31, 2025
@cathysarisky cathysarisky changed the title {{content words}} error? {{content words}} error with CTA Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:triage [triage] this needs to be triaged by the Ghost team
Projects
None yet
Development

No branches or pull requests

1 participant