I've set up an archive page as described in the docs... so my archive page url looks something like this http://mysite.dev/news/2014/09.

How do I then make the title display Archive for September 2014?

The {{ month }} variable is set as 09 and doing this -> {{ month|date("F") }} outputs January not September.

Any help would be appreciated.


Figured out a way to do this if anyone who has the same problem.

    {% if year is defined and month is defined %}
    {% set archiveDate = year ~ '-' ~ month ~ '-01' %}
    <h2 class='archive-title'>Archive for {{ archiveDate|date('F') }} - {{ year }}</h2>
    {% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.