# One library, a section per year

*Collection: Displaying Libraries · Category: Display · Availability: FileDeck Free · Canonical URL: https://www.getfiledeck.com/docs/group-by-year/*

Minutes, newsletters, annual reports and accounts are usually read by year:
this year's first, last year's below. The common way to build that page is a
category per year and a stack of libraries, one per category, with a new
category to add every January.

**Group by year** builds it from one library. Each year becomes a titled
section with its document count, newest year first. One search box and one
set of filters cover every section, and a section whose documents are all
filtered out disappears until they come back.

> **Free** — included in every FileDeck install.

## Turn it on

Per library, on the shortcode:

```
[filedeck group_by="year"]
```

In the [library builder](https://www.getfiledeck.com/docs/library-builder/) and the Elementor widget:
**Sections → A section per year, newest first**. Site-wide, as the default for
every library: **Documents → Settings → Display → Group by → Year**.

It works with the table, grid and gallery layouts. The
[folders layout](https://www.getfiledeck.com/docs/folder-layout/) groups by category on its own, so the
option does nothing there. 

## Which year a document goes in

The year comes from the document's date: the date it was published, or the
date you set on its edit screen (or in a [CSV import](https://www.getfiledeck.com/docs/csv-import/)'s
`date` column). To file last year's minutes under last year, give them last
year's date. A theme that hides post dates doesn't change which section a
document lands in.

Within each year, documents keep the library's own order (`sort_by` and
`sort_order`), so `sort_by="date" sort_order="desc"` puts each year's newest
document at the top of its section.

## Combine it with the year filter or a category

The [year filter](https://www.getfiledeck.com/docs/year-filter/) still works alongside the sections:
picking a year hides every other section. To show one kind of document by
year, scope the library to its category:

```
[filedeck group_by="year" category="board-minutes" sort_by="date" sort_order="desc"]
```

Grouped libraries render every document at once, so they do not paginate and
do not switch to server mode. For libraries in the thousands of documents, use
the year filter on an ordinary library instead.

## FAQ

### Can I put the oldest year first?

Not yet: year sections run newest first, which is how most archives are read.

### Can I style the year headings?

The section headings are `<h3>` elements with the class `fdk-group-title`,
and the count pill is `.fdk-group-count`, the same as category sections.
Style them with CSS scoped to `.filedeck`.

### Does search still cover every year?

Yes. One search box covers every section, and sections with no matches hide
while the search is active.
