# Filter a library by year

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

Minutes, newsletters, magazines, accounts, annual reports: a lot of libraries
are organised by the year a document belongs to, and the first instinct is to
create a category or a tag per year. It works, but every January there is a
new one to create, and the category list fills up with numbers.

The **year filter** reads the year from each document's date instead.
Switch it on and a dropdown listing the years the library actually spans
appears with the other filters — newest year first, and only years that hold
a document.

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

## Turn it on

Site-wide: **Documents → Settings → Features → Show a "year" filter**.

Per library: add `show_year_filter="1"` to the shortcode, or switch on
**Year filter** on the Elementor widget.

```
[filedeck show_year_filter="1"]
```

The filter appears only when the library spans more than one year — a
dropdown with a single choice is noise, so a library whose documents all
date from this year shows nothing until next year's arrive.

## What year a document has

The document's **date** — the publish date WordPress records, which you can
edit on the document's edit screen (the "Publish" box, or the date field
under the title in the block editor). Set it to the date the document is
*about* rather than the day you uploaded it: a 2019 newsletter dated 2019
files itself under 2019, and the library's date column and "newest first"
sort follow the same date.

If you are bringing an archive over from files on disk, the
[bulk upload](https://www.getfiledeck.com/docs/upload-documents-bulk/) and the Pro
[CSV import](https://www.getfiledeck.com/docs/csv-import/) get the files in quickly, but neither sets
the date: every document starts dated the day it was added, so set each
one's date on its edit screen afterwards.

## Pinning a library to one year

The shortcode's `year` attribute does the same job with no control:

```
[filedeck year="2025" category="minutes"]
```

gives you "the 2025 minutes" as a block for a page of its own. Combine
`year` with `category`, `tag` or anything else; it simply narrows the
library to documents dated in that year.

## Sharing a filtered view

The year a visitor picks lives in the address bar like every other filter
(`?filedeck_year=2024`), so the **Copy link** button above the library, and
a plain copy of the URL, both reproduce the view. See
[sharing a filtered view](https://www.getfiledeck.com/docs/search-sort-filter/#sharing-a-filtered-view).

## FAQ

### Can visitors pick a year and a category at once?

Yes. The year filter works alongside the category, tag and custom-field
filters, and the counts beside the other filters' options update to reflect
the year chosen.

### Does it work in the folders layout?

Yes. Folders that hold no document from the chosen year collapse out of the
way, exactly as they do for a search.

### Does it work on very large libraries?

Yes. Past the size where a library switches to server mode, the year list is
read from the whole library rather than the page on screen, and the pick is
applied on the server.

### I already have "2024", "2025" categories. Should I remove them?

Not necessarily. If your documents' dates are right, the year filter will
give visitors the same result with no maintenance, and you can retire the
per-year categories at your own pace. If the dates are not reliable, keep
the categories — the filter reads dates, not names.
