Mecha CMS

Add extra functionality to the core engine.

Archive

Table of Contents
  1. Variables 
  2. Conditions 
  3. Classes 

List all pages in the current folder filtered by time.

Download Stable Version Download Development Version

Something looks broken? We accept bounties to fix them faster.

^72 Downloads
v1.1.015 Downloads
v1.0.168 Downloads

This extension activates the time filter feature by utilizing the time property of the page to add several routes such as https://mecha-cms.com/blog/archive/:archive on every page to allow users to list all pages in the current folder by time.

As a note, every time you want to link a page to a specific year-based archive, be sure to add the pagination offset to the end of the URL to prevent Mecha from mistakenly interpret the archive year as pagination offset:

https://mecha-cms.com/blog/archive/2020 ✘
https://mecha-cms.com/blog/archive/2020/1 ✔

Other than that are safe enough, even though I would prefer you to add it anyway, for consistency:

https://mecha-cms.com/blog/archive/2020-09/1
https://mecha-cms.com/blog/archive/2020-09-18/1

Variables 

A global variable $archive will be available in archives page mode. This variable is an instance of the Time class which you can use to get the archive time portion from the URL.

Conditions 

These page conditional statements are available:

  • $site->is('archives') → Return true if current items view is an archives view and is not empty.

Classes 

These HTML classes will be added to the <html> element that has a class attribute:

  • is:archives → Will be added if current items view is an archives view and is not empty.