You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Hmm, this is an interesting one. I think it's certainly unexpected that content expands past the words=x boundary.
However, regarding the CTA, what's the use-case for {{content words="x"}} here? It sounds like it's being used in place of the {{excerpt}} helper which is intended for these short previews on index pages where the full post + CTA injection of {{content}} doesn't make sense.
Bulletin /could/ use it to good effect to load a couple paragraphs of content. But it looks like it loads and hides it the full body of the post.
But I would see {{content words="x"}} being useful in cases like that - where you want multiple lines of formatted text in a preview, before a 'read more'. The {{excerpt}} is OK for cases like Ruby where just a few un-formatted words are wanted, but it doesn't work in a theme where longer formatted text is wanted.
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
The text was updated successfully, but these errors were encountered: