Skip to content

How can I create an archive page sorted by years (with post count) and months (also with post count)? #906

Discussion options

You must be logged in to vote

The method pages->group() is available in the Yellow API now, it supports custom date formats.

pages->group("published", false, "Y") = group content by publication year with descending date
pages->group("published", false, "Y-m") = group content by publication month with descending date
pages->group("published", false, "Y-m-d") = group content by publication day with descending date

Here's an example layout file to show a blog archive with years and months :

<?php $this->yellow->layout("header") ?>
<div class="content">
<div class="main" role="main">
<h1><?php echo $this->yellow->page->getHtml("titleContent") ?></h1>
<?php echo $this->yellow->page->getContentHtml() ?>
<?php $pages = $this->

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@pftnhr
Comment options

@pftnhr
Comment options

@markseuffert
Comment options

@markseuffert
Comment options

Answer selected by pftnhr
@pftnhr
Comment options

@markseuffert
Comment options

@pftnhr
Comment options

@markseuffert
Comment options

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