Skip to content

Commit

Permalink
chore: add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
DavieReid committed Nov 2, 2023
1 parent e8a9037 commit 5488652
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .changeset/ninety-coins-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
'@jpmorganchase/mosaic-plugins': patch
'@jpmorganchase/mosaic-site': patch
---

## Feature - Advanced Sidebar Sorting

Given a directory of pages, you can provide a sidebar sort config in the frontmatter of the directory index page which will be used to sort the other pages in the directory.

The sort config consists of:

- field: the path, separated by a '/', to the page metadata you want to use for sorting e.g. title or data/publicationDate
- dataType: 'string' or 'number' or 'Date'
- arrange: 'asc' or 'desc'

Note that a page can still specify its sidebar priority and this will overrule any sort config specified in the index page.

## Example

Let's say you have a "Newsletters" directory which has an index page and multiple newsletter pages in the same directory.

Each newsletter page has a data property which includes the publication date of the newsletter.

To order the newsletters in the sidebar in descending order (the newest newsletter first):

Add the following to the **index** page frontmatter:

```
sharedConfig:
sidebar:
sort:
field: data/publicationDate
dataType: date
arrange: desc
```

0 comments on commit 5488652

Please sign in to comment.