where is the for statement coming from? is that in the page content?
Not sure you will be able to strip that easily, and there are probably other use cases where you will get something unintended. When I do the description if there is no page description I put in a generic site.deescription - and make sure that I always have a page description.
It’s in a regular page (.md file), which is acting like a category page for a collection.
Historically I’ve done the site.description call as a fallback, but it doesn’t work well in a lot of cases so I’m looking for something more relevant when a page description isn’t provided in front-matter.
Have you tried page.excerpt? That might strip it.
It also has the benefit of being overidded. If you don’t like the excerpt Jekyll automatically creates you can manually add it to the page’s front matter
excerpt: "I like this excerpt better than the automatically generated one."
If I manually add excerpt: "I like this excerpt better than the automatically generated one." to the page’s front-matter, then yes, it will display “I like this excerpt better than the automatically generated one.” when I call page.excerpt.
Well, you’re right, looks like excerpts only work in posts. I did some testing and I can get the liquid for loop to work in a post, and post.excerpt works as expected.
I’m having the same problem. Using page.excerpt would solve my problem, except that I use liquid includes to add responsive images to my posts. With page.excerpt these includes are applied (not bad perse), but the huge code spans consistently hit my truncatewords: '40' limit. As a result, the expanded code is truncated, with the excerpt’s content ending somewhere mid way that code. Which results in invalid HTML. Any tips on getting rid of the liquid tags altogether?