Log in Sign up

Supress title-less posts in Archive listing?

I’m experimenting with blogging a combination of traditional, long form blog posts, and shorter, micro.blog/twitter-like short posts that are just a couple of sentences. This works really well on Blot with the blog theme.

However, I was wondering if it’s possible to suppress the short form posts in the Archives using some template magic. The best distinction I can think of is that the short posts don’t have an explicit title, they’re just text.

I assume I could do this with custom metadata, but am curious if there’s another way.

Thanks!

3 replies Asked Oct 3 '21 at 15:58 · Improve this question

Reading other questions seems to confirm metadata would let me do this. For example, setting a blank title: for short-form posts, or archive: true for long-form posts, and then filter on that in my archives template. But maybe there’s a way to detect if the post has a headline (#) or title: set?

Answered Oct 4 '21 at 15:09 · Improve this answer

You can detect if a post has a headline (#) by filtering on the titleTag property of each entry. For example, this will produce a list of all the entries on your site which contain a headline:

{{#allEntries}}
  {{#titleTag}}
    <a href="{{{url}}}">{{title}}</a>
  {{/titleTag}}
{{/allEntries}}

And this will produce a list of entries which don’t have a headline tag:

{{#allEntries}}
  {{^titleTag}}
    <a href="{{{url}}}">{{title}}</a>
  {{/titleTag}}
{{/allEntries}}

Does that help? Please let me know if you have any questions about this or anything else

Answered Oct 4 '21 at 15:13 · Improve this answer

That’s exactly what I was hoping to find!

Apologies, I should have read the docs more carefully.

Thank you!

Answered Oct 4 '21 at 23:00 · Improve this answer

Please, log in to add a reply.