Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort by year then month? #17

Open
morrow95 opened this issue Dec 17, 2016 · 0 comments
Open

sort by year then month? #17

morrow95 opened this issue Dec 17, 2016 · 0 comments

Comments

@morrow95
Copy link

I just started playing around with grav the other day, but I did notice something I would like to do with the output of the archives... sorting by year then month within each year?

Is this possible? I know I can do something like archives_year:2014 and archives_month:jun_2014, but is the looping possible the way the plugin is setup?

The default is something along the lines of :

{% for month,items in archives_data %}
    <li>
    	<a href="{{ base_url }}/{{ config.plugins.archives.taxonomy_names.month }}{{ config.system.param_sep }}{{ month|date('M_Y')|lower|e('url') }}">
        {{ month }}
        </a>
        {% if archives_show_count %}
        	({{ items|length }})
        {% endif %}
    </li>
{% endfor %}

I would need a loop for each year and then another for each month/item in that year... so is there a way to 'store' each result array and loop through each month then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant