Hello.
I have successfully implemented Netlify CMS on my website and so far it’s working perfectly. However, I have a question regarding sortable_fields
. Is it possible to use a custom date field in this parameter?
I’m setting dates in my frontmatter like this:
---
title: "String"
date: 2018-01-18
description: "String"
---
And this is my config:
backend:
name: git-gateway
repo: <username>/<repo>
publish_mode: editorial_workflow
media_folder: 'static/images/'
public_folder: 'images/'
site_url: <url>
display_url: <url>
collections:
- name: 'blog'
create: true
label: 'Blog'
label_singular: 'Post'
folder: 'content/blog'
path: '{{slug}}/index'
media_folder: 'assets/'
preview_path: '{{dirname}}'
editor:
preview: true
sortable_fields: ['title', 'fields.date']
fields:
- { label: 'Title', name: 'title', widget: 'string' }
- { label: 'Date', name: 'date', widget: 'datetime' }
- { label: 'Description', name: 'description', widget: 'string' }
- { label: 'Body', name: 'body', widget: 'markdown' }
The date seems to work fine to sort in an asending order (older posts at top), however I’m not able to sort the posts in an descending order (newer posts at top). Is it something that I’m doing wrong or if it’s not supposed to work at all?
Not sure if it’s relevant, but I’m using Hugo.