Only Show Specific Posts On Homepage


#1

I am in the process of starting up a monthly magazine using the Casper theme.

What I want to do is, for each month, only show posts with a specific tag on the homepage. So, for the first month, only posts tagged: “Vol. I, Number I, February 2019” would appear.

The rest of the posts will be available through an Archive page, with links (Vol. I, Number 2, March 2019) that will take the user to collections of previous issues of the magazine that are tagged and collected accordingly.

Is there a way that I can do this, and in such a way that I can change the specific tag to be fetched each month?

An alternative method might be to limit the number of posts visible. So, if for one month there are only five essays, is there a way that I can set the homepage to only show five posts and hide the rest? The rest, of course, will be available and collected accordingly through the Archive page and links.

I have little experience in this sort of stuff, but if directions are clear enough, I can usually figure it out.

Thank you.


#2

You should be able to solve your use case with dynamic routing.

You can filter the homepage by the tag you would like to specify.

e.g. just an example

routes:

collections:
  /archive/:
    permalink: /{slug}/
    filter: -tag:month1
  /:
    permalink: /{slug}/
    filter: tag:month1

#3

Kate,

Thanks so much for getting back to me. This is really helpful.

I went to labs and downloaded the current routes.yml. I used Brackets to open the file, and replaced the original text with:

routes:

collections:
/archive/:
permalink: /{slug}/
filter: -tag:vol-i-number-i-february-2018
/:
permalink: /{slug}/
filter: tag:vol-i-number-i-february-2018

When I try to upload it, I get this message: Could not load routes.yaml file.

What am I doing wrong?

Thanks again.


#4

Can you please share the server log error?


#5

I’m so sorry, but I’m not sure how to find those and show them to you. This screen shot is the best that I can do. Like I said, I can’t even call myself a novice.


#6

It might just be worth it for me to pay somebody to set this up and walk me through using it. Should I create a new post about that?


closed #7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.