Log in Sign up

Can I display a customised list of posts inside a Page?

I want to have a curated list of topics on the main menu. I can do this using tags (by putting the tagged url in the menu), but this doesn’t allow me to have a custom introductory text for each tag.

Say I want to put Coffee and Cities on my menu. I want to write something about coffee in general, followed by a list of all posts tagged coffee. Ditto, for Cities. The introductory text is different for the two topics, so I can’t just put it in tagged.html

Will be grateful for tips that’ll help me achieve this. Thanks.

1 replies Asked Jun 21 '21 at 10:08 · Improve this question

If you’re willing to bake the text into your template, you could use CSS to conditionally hide/show paragraphs based on the tag. For example, you could add the following to your template’s tagged.html view to hide all introductory paragraphs without the current tag:

<p class="intro apple">This is the introduction shown for the tag apple.</p>

<p class="intro orange">This is the introduction shown for the tag orange.</p>

<style type="text/css">
.intro:not(.{{tag}}) {display:none}
</style>

If however, you plan to edit the custom introductory text for each tag regularly and would like to store the text in your folder, please let me know. I can provide an even hackier workaround!

Answered Jun 22 '21 at 15:26 · Improve this answer

Please, log in to add a reply.