Displaying the Month & Year on an Archive Page

Hi @fair

You could try extracting the date information from the URL

{% if archive_list_page %}
 {% set archive_params = request.path|split('archive')|last %}
 {% set archive_parts = archive_params|split('/') %}

 {% if archive_parts|length > 1 %}
 {% set months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] %} 
 {{ months[ archive_parts[1] - 1] ~ " " ~archive_parts[0] }}
 {% else %}
 {{ archive_parts[0] }}
 {% endif %}
{% endif %}

This would work for when you have filtered by months and years as well as just years.

I tried to use date formatting but it kept throwing an error when trying to create a date string from the url parts, so had to resort to creating an array of months and matching the index.

Hope this helps.

Karla