Skip to main content

How to create a button that dynamically links to the current month's posts

The request

How do I generate a link that points to the current month’s archive (so the month during the month of May the link would be something like <a href="/2022/05/">See more posts from this month</a>. View original thread

The solution

<a href="{Date format='/Y/m/'}">See more posts from this month</a>

The explanation

The Date tag can be used to dynamically render the current date or some other desired date to fill the href attribute of the anchor tag. If instead of linking to the current month's archive we wanted to link to the previous month's archive, we could add the attribute subtract="1 month" to our Date tag.