Log in Sign up

How to use the {{more}} tag?

I am changing entries.html so that it only shows {{{summary}}} of a blog post. I would like to indicate a "more" link if there is more text.

The {{more}} tag contains this information -- but how can I use this to display a "More" links? Can Mustache do this? Or do I need JavaScript?


2 years ago, 3 replies   Edit question

You can't accomplish this perfectly using the {{summary}} tag, since the {{more}} tag relates to the {{teaser}} tag. This will work:

{{#entries}}

  {{{teaser}}}

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

  <hr>

{{/entries}}

This is another option:

{{#entries}}

  <h1>{{title}}</h1>
  <p>{{{summary}}}</p>
  <a href="{{{url}}}">Read more</a>
  
  <hr>

{{/entries}}

Finally, you could always use your own custom metadata to accomplish this. Please let me know if you have any questions about this or anything else.

Answered 2 years ago · Edit answer

Thanks for this! I didn't realise that I can implement if-logic via the {{#... syntax.

Is there a way to globally set how long teasers are meant to be?

Answered 2 years ago · Edit answer

There is no global control over teasers right now, but I plan to add the feature in future. I'll follow up here when it's ready

Answered 2 years ago · Edit answer