Skip to content

Archives ​

An archive lists projects or posts as cards: the Works pages and the journal. Each is one component, PostsArchive, whose cards are written into the page, so what it lists is the cards in the file and how it shows them is its options and classes.

PageHow it shows the cards
works.htmlGrid, by year, more cards on a click, the visitor switches to a list
works-4-columns.htmlFour columns with filters by category
works-list.htmlA list by year with filters by category
works-dark.htmlTwo columns on a dark page, more cards as the visitor scrolls
works-pagination.htmlGrid with numbered pages
works-lightbox.htmlGrid whose pictures open in the lightbox, with filters by year
works-category-<name>.htmlOne category's projects
journal.htmlThe posts as a list, more on a click
journal-category-<name>.htmlOne category's posts

An archive split over several pages is several files: works.html, works-page-2.html and works-page-3.html each hold their own cards, and the archive's links lead from one to the next. Adding a card: Add a project and Add a post.

How to access ​

Any archive page → <div with data-arts-component-name="PostsArchive"

html
<div
  class="posts-archive posts-archive_portfolio js-posts-archive posts-archive_filter-bar posts-archive_has-filters posts-archive_columns-4 posts-archive_gap-compact"
  data-posts-archive-view="grid"
  …
  data-arts-component-name="PostsArchive"
  data-arts-component-options='{"view":"grid","switchable":false,"paginationMode":"numbered","groupByFacet":"year","columnsChoices":[1,2,3,4],"filterFacet":"category"}'

Changing the columns and the gaps ​

The classes on the archive set its columns on wide screens: posts-archive_columns-2 or posts-archive_columns-4, and three without either. Its gaps are posts-archive_gap-compact, posts-archive_gap-tight or posts-archive_gap-wide, and the page's gutters without any. Works / 4 Columns in two wide columns:

html
class="posts-archive posts-archive_portfolio js-posts-archive posts-archive_filter-bar posts-archive_has-filters posts-archive_columns-2 posts-archive_gap-wide"

Showing a grid or a list ​

Set "view" in the options to "grid" or "list", and data-posts-archive-view beside them to the same value. On an archive with "switchable":true, the visitor's own choice of grid or list is remembered and wins over yours when they come back.

html
data-posts-archive-view="list"
…
data-arts-component-options='{"view":"list","switchable":true,"paginationMode":"load_more",…}'

More cards on a click, or as the visitor scrolls ​

"paginationMode":"load_more" shows a button that loads the next file's cards; "infinite" loads them as the visitor reaches the end. Change it in every file of the archive. Infinite loading also needs this line right after the <div class="posts-archive__more …"> that holds the more button, as works-dark.html has it:

html
<div class="posts-archive__sentinel js-posts-archive__sentinel"></div>

Without that line the archive stops at its first file. For numbered pages, start from works-pagination.html and its two -page- files instead.

Keeping the counts right ​

The count beside the archive's heading is written into the page

The numbers an archive prints are text in the page, so a card you add or remove leaves them as they were. Change them in each file of the archive:

  • the count beside the heading, (16);
  • Showing All 16 Works or Showing All 7 Posts, which the more button shows once every card is loaded;
  • Load 6 More, the number of cards in the next file.
The more button names the number of cards the next file holds

The filters and the year groups need no edit: they read each card's data-grid-facets and data-grid-group.

Next, the settings every page shares: config.js.