Your sites Log in Sign up Menu

How do I display a teaser from the content of a post?

I have searched the documentation and the questions here, but I have not found an answer to the question.

If I have a post, and I want to display an excerpt (teaser) for it on the list of posts (using the Diary template), how do I accomplish this without having to duplicate post content in the metadata section?

I have tried a variety of combinations of the {{{teaser}}} and {{more}} special tags in my post content but nothing seems to work. I simply want to know how I can flag the first paragraph of the post as a teaser. Thanks for any help you can provide.


3 years ago, 5 replies   developers   Improve this question

You will need to edit your template’s source code. First, make sure you have forked an editable version of the Diary template.

Then open up entries.html in your template's source code and replace the {{{html}}} tag in it with the following:

{{{teaser}}}

You can learn more about these tags in the Developer Documentation. Please let me know if you have any questions about this or anything else.

Answered 3 years ago · Improve this answer

Thank you. That worked.

Answered 3 years ago · Improve this answer

Adding on to this, when using the {{more}} tag in conjunction with {{{teaser}}}, how would I prompt the display of "Read more..." or something similar in place of the {{more}} tag in a blog post?

Answered 3 years ago · Improve this answer

At a high level, Blot extracts a teaser for each entry. You can decide to show this teaser in your template.

You can determine how much of the entry is included in the teaser by inserting the tag {{more}} into the source file of the entry. Everything before {{more}} will be included in the teaser.

Now for short posts, the default teaser and the full entry will be the same. With that in mind, here's how to show a Read more link on the entries.html page only for entries with a teaser that is shorter than the full entry:

{{{teaser}}}
{{#more}}
<a href="{{{url}}}">Read more</a>
{{/more}}

Here's how to show a Read more link regardless of the difference between the teaser and the full entry:

{{{teaser}}}
<a href="{{{url}}}">Read more</a>
Answered 3 years ago · Improve this answer

Thank you again. That works perfectly.

Answered 3 years ago · Improve this answer