Forum
Word/Char limit not working for blog excerpt
I would like to display two blog post excerpts of different length in different places on my website.
When adding a post, this is what I use to collect the excerpt:
<perch:blog id="excerpt" type="textarea" label="Excerpt" suppress="true" size="s" required="true" count="words" help="25 words maximum." />
Then I include it on the frontpage like this:
<perch:blog id="excerpt" type="text" words="12" append="…"/>
It works, when I leave out the words="..." limit, but when I include it, nothing is output. In my newsfeed, I want to output it similarly, but with 25 words:
<perch:blog id="excerpt" type="text" words="25" append"…" />
Again, when I include the word limit, nothing is output anymore. Same goes for a char limit.
I also tried including the word limit right in the post.html template:
<perch:blog id="excerpt" type="textarea" label="Excerpt" suppress="true" size="s" required="true" count="words" words="25" help="25 words maximum." />
When saving the blogpost, this is the output in the debug area:
[excerpt] => Array
(
[_flang] => plain
[raw] => Waterford Kamhlaba is very grateful to our alumni for their continued involvement and support to activities at our school. This was evident during UWC Africa Week 2015 in July, where many came out to support the different activities lined up during the week.
[processed] => Waterford Kamhlaba is very grateful to our alumni for their continued involvement and support to activities at our school. This was evident during UWC Africa Week 2015 in July, where many came out to support the different activities lined up during the week.
)
Clearly, the word limit has no effect on the output.
My questions are: Why is it not working? What am I doing wrong? Where should I include the word limit ideally?
Thanks for your help!
Can you try with
type="textarea"
?Of course! How did I not see that?!
That did it, thanks a bunch!