Link to most recent post in a CMS

Hi,

I’m looking for a way to create a link to the most recent post in a CMS collection without having to manually update all the links every time there is a new post. From the homepage, I can create a link to a URL, a page, or a page section. However, linking to the most recent post from a CMS collection eludes me.

Any help is much appreciated!

Welcome to the Webflow forums @dannytaro :webflow_heart:

Just so I’m certain what you’re asking, are you trying to simply have a single link on the homepage showing the latest item, e.g. a blog post? I think I have the solution for you but just want to make sure first.

1 Like

Ok, so I already have this set up on one of my sites. If you follow this share link and take a look at the “Recent News Posts” section. The four news posts you see there are all within a single Collection wrapper, which is linked to the News CMS collection.

If you wanted to simply display one (i.e. your most recent one), then you would simply change the filter applied to the settings of the Collection Item element (click on it, go to the settings, and you will see that I’ve set a limit of 4, with a sort order of newest to oldest. You would simply set this to a limit of 1).

If you are still stuck, I highly recommend Webflow’s awesome video tutorial on the topic available here.

1 Like

Hi Andy, thanks for reading through my lingo. This is close to what I would like to achieve, except I don’t want the CMS item to be visible on the homepage. Just a single, unchanging element that links to the latest post.

No worries bud!

Ok, so that’s easily achievable. If you take a look at all the different child elements of Collection Item, you’ll see that there’s an image, text, button to read the full post etc. That button element is all you need.

So, strip everything out that you don’t need, keep the button (linked to the collection), and set the button’s URL to be “Current Post”.

By following the above, you will have a collection wrapper in place, set to display a single item, and ordered so that it always links to the most recent post. The button’s URL is dynamic, but the “Read Post” text (or whatever you want it to say) is static and unchanging.

Here’s the settings that you need for the button. It should be super simple for you to set up. Let me know how you get on, and if any of the above doesn’t make sense.

image

3 Likes

Here, I just created an example for you which I think achieves what you want. Let me know if I’ve misunderstood :slight_smile:

https://preview.webflow.com/preview/cms-button?utm_medium=preview_link&utm_source=designer&utm_content=cms-button&preview=961932824158b50df79bb57d556bc0b4&mode=preview

Thank you so much this is exactly what I needed!

1 Like

Awesome, glad it helped! :slight_smile:

1 Like

Cannot open those pages anymore, can anyone help? Have the same issue :slight_smile: