Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sorting ability to list of entries #54

Open
phae opened this issue Aug 10, 2016 · 38 comments
Open

Add sorting ability to list of entries #54

phae opened this issue Aug 10, 2016 · 38 comments

Comments

@phae
Copy link
Contributor

@phae phae commented Aug 10, 2016

User needs:

  • to more efficiently be able to locate a post when browsing manually

So, we should add some basic filters to reorder the list of posts that have already gone live.

Minimum options for now.

Acceptance criteria:

  • User can click a link to re-order the posts from newest to oldest, and visa versa
  • User can click a link to re-order the posts in alphabetical and reverse-alphabetical
    #50 is prerequisite for this.
@phae phae added the React label Aug 10, 2016
@phae phae modified the milestone: Beta Aug 30, 2016
@cassiozen cassiozen removed this from the Beta milestone Jan 14, 2017
@cassiozen cassiozen added kind: feature and removed React labels Jan 14, 2017
@erquhart erquhart added this to Triage in Planning Mar 10, 2017
@erquhart erquhart moved this from Triage to Backlog in Planning Mar 14, 2017
@erquhart erquhart modified the milestone: 1.0.0 Sep 8, 2017
@erquhart erquhart changed the title Add filtering ability to list of posts Add sorting ability to list of posts Feb 22, 2018
@erquhart erquhart changed the title Add sorting ability to list of posts Add sorting ability to list of entries Feb 22, 2018
@loremipson

This comment has been minimized.

Copy link
Contributor

@loremipson loremipson commented May 18, 2018

Requesting some more flexibility here. What do you all think about accepting some optional yaml in the config that would result in both additional fields being displayed in the entry list, as well as making them sortable?

Something like:

collections:
  - name: posts
     label: Posts
     folder: src/posts
     create: true
     fields:
       - { name: title, label: Title, widget: string }
       - { name: publishedDate, label: Published Date, widget: datetime }
       - { name: editedDate, label: Edited Date, widget: datetime }
       - { name: body, label: Body, widget: markdown }
     sortableFields: ["title", "publishedDate", "editedDate"]
@mittalyashu

This comment has been minimized.

Copy link
Contributor

@mittalyashu mittalyashu commented Sep 13, 2018

I have created this. It is similar to what @phae said.

group 4

Check the source file.

@tomrutgers

This comment has been minimized.

Copy link
Collaborator

@tomrutgers tomrutgers commented Sep 13, 2018

Looks good! I would split the ascending / descending functionality from the select box though. So a select box to select the sort modifier and one button to switch between ascending and descending.

@mittalyashu

This comment has been minimized.

Copy link
Contributor

@mittalyashu mittalyashu commented Sep 13, 2018

That will take too much of space from design prospective. Why not just keep inside a single component.

I know the title of the button is wrong, but the image is just to show the design.

@enriquemorenotent

This comment has been minimized.

Copy link

@enriquemorenotent enriquemorenotent commented Sep 13, 2018

Is this request really 2 years old? This is so important!

@Herohtar

This comment has been minimized.

Copy link
Contributor

@Herohtar Herohtar commented Sep 13, 2018

@mittalyashu Taking more space is preferable to having a confusing UI component. "Ascending" and "Descending" are sort directions and should be separate from the list of fields to sort by. Not to mention that the way they're displayed there implies you can somehow select both at once.

@tomrutgers

This comment has been minimized.

Copy link
Collaborator

@tomrutgers tomrutgers commented Sep 13, 2018

I agree with @Herohtar. Also: it does not have to take up extra space. If you move the asc/desc icon out of the select box and use it as a button you'd have the outcome I mean.

@mittalyashu

This comment has been minimized.

Copy link
Contributor

@mittalyashu mittalyashu commented Sep 13, 2018

Okay, I will try and do some brainstorming 😜.

@JasonHanley

This comment has been minimized.

Copy link

@JasonHanley JasonHanley commented Sep 24, 2018

Very impressed with many aspects of this project, but from the perspective of someone evaluating different static CMS tools, having content show up in hard-coded reverse-alphabetical order is a fairly glaring deficiency, and makes it unsuitable for production use. Not being a React expert, I can't even find where in the source to change this.

I'd be happy just to have a simple config option control this, and that might be simpler to implement.
sort: [fieldname] [asc|desc]

In the meantime, is someone able to point me to the source where this is hard-coded?

@enriquemorenotent

This comment has been minimized.

Copy link

@enriquemorenotent enriquemorenotent commented Sep 24, 2018

@JasonHanley That is an interesting thought. I never considered hacking it myself :D

I have not really taken time to analize it well, but my bet would be in this file:

https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js

Either line: #50 or #55. Not sure which one of those 2 methods is used, but I would bet that one of those 2 arrays (or maybe boths) need a sort function.

@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Sep 24, 2018

Note that this is more complex than it seems - in many cases you're dealing with a paginated list, in which case more entries load as you scroll. Sorting would therefore have to be supported by the backend in use, or else we need to load all pages up front before sorting.

Sent with GitHawk

@JasonHanley

This comment has been minimized.

Copy link

@JasonHanley JasonHanley commented Sep 25, 2018

Ugh, I do see the trickiness, assuming you're using something like https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/src/%7Bnode%7D/%7Bpath%7D to list the files in a folder.

The best you could do is sort by file name or file size. In that case, I don't see any way to avoid loading, parsing, and caching all entries upfront. It's a bit of a shame you have to load the entire file just to get the front matter.

@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Oct 24, 2018

I spoke w/ @Benaiah recently about using sha's to pseudo cache. The big 3 Git hosts all provide some kind of commit diffing via API:

With the ability to see files that changed between two commits, we can create a sort of index in a data file in your repo, updating changed bits on load, and never needing to download all entries (except to create the original cache, or if the cache is somehow lost).

Still some work to do on the concept, but it does feel feasible.

@Jones-S

This comment has been minimized.

Copy link

@Jones-S Jones-S commented Mar 27, 2019

I see that this issue is included in the dev cycle ending on 29th of March. Will this mean that we can soon see some sorting within the netlify cms?

@barbalex

This comment has been minimized.

Copy link

@barbalex barbalex commented Apr 17, 2019

I had almost decided on using netlify-cms for two projects. Then I realized that not being able to sort was a no-go for my client :-(

I understand the problems and realize it is hard to solve. Aside from this: great project!

@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Apr 17, 2019

@barbalex question: we're about to implement this, but initially it will be config driven, so you can set the sort in config but won't be able to change it in the UI. Regardless of whether it's too late to actually use it for your client, I'm curious whether what I'm describing would satisfy your requirements?

Sent with GitHawk

@barbalex

This comment has been minimized.

Copy link

@barbalex barbalex commented Apr 17, 2019

@erquhart Yes, config would suffice as entries would be sorted by a date field, descending. Plus: I can wait a few weeks. Looking forward to this feature!

@otaviowillow

This comment has been minimized.

Copy link

@otaviowillow otaviowillow commented May 12, 2019

@erquhart is this still on the roadmap?

@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented May 12, 2019

Absolutely, just didn't get it out as soon as I had hoped.

Sent with GitHawk

@talves talves mentioned this issue May 29, 2019
@erquhart erquhart moved this from Ready For Development to In Progress in Priority Issues Jun 5, 2019
@snoopdouglas

This comment has been minimized.

Copy link

@snoopdouglas snoopdouglas commented Jun 29, 2019

Great that this is being developed now. Sorting is the last major hurdle for our clients too.

How is this going to work with sorting by custom fields? Is this now part of the acceptance criteria as per @loremipson's suggestion?

With hundreds of pages, I'd imagine this could get quite slow as we'd be bombarding {your git host} with requests on every single client-side sort. So, will the CMS maintain in-repo index files? eg.

`/.netlify-cms/indexes/${collection}/${field}.json`
@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Jun 29, 2019

That's a part of the plan, I expect repo indexes to play a big role in many features and improvements in the future. Initially this will likely all be in memory. Perf won't be great for large collections, but it will initially be configuration driven (no UI sort selection), so the impact will be limited.

Sent with GitHawk

@wing5wong

This comment has been minimized.

Copy link
Contributor

@wing5wong wing5wong commented Jul 18, 2019

Waiting on this too - just been asked whether or not this is possible to do rather than the current alphabetical.

config only is fine - specifically wanting reverse date order (newest entries at top of list)

@nratter

This comment has been minimized.

Copy link

@nratter nratter commented Sep 24, 2019

Any updates on this? Config only is fine for our case as well.

@erquhart

This comment has been minimized.

Copy link
Member

@erquhart erquhart commented Sep 25, 2019

Still coming. Became a part of a bigger effort (🤦‍♂) but will be out soon.

@alfchee

This comment has been minimized.

Copy link

@alfchee alfchee commented Oct 9, 2019

I would like you may add this feature to the CMS, it would be great to be a able to decide how to sort the items of different collections in the CMS.

@erquhart erquhart self-assigned this Oct 28, 2019
@BIIGitHub

This comment has been minimized.

Copy link

@BIIGitHub BIIGitHub commented Dec 4, 2019

Any updates on this??

@shushugah

This comment has been minimized.

Copy link

@shushugah shushugah commented Dec 26, 2019

Bump, my file names are numeric based, and it's annoying that right now it sorts by, without any option to sort by date

1.md
10.md 
11.md
2.md
3.md
@marcneander

This comment has been minimized.

Copy link

@marcneander marcneander commented Jan 7, 2020

Would love an update on this.

Currently no way to sort in a decent way? Best workaround I've found is using "{{year}}-{{month}}-{{day}}" or similar as slug. However, when updating an item NetlifyCMS is not updating filenames.

Am I doing something wrong or are we missing this very basic and crucial feature?

@erezrokah

This comment has been minimized.

Copy link
Collaborator

@erezrokah erezrokah commented Jan 7, 2020

Best thing you can do is up vote the issue as we use it for prioritization. This is currently number 4: https://github.com/netlify/netlify-cms/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

@bencao

This comment has been minimized.

Copy link

@bencao bencao commented Jan 13, 2020

definitely an up vote for this feature.

@cloudcrestconsulting

This comment has been minimized.

Copy link

@cloudcrestconsulting cloudcrestconsulting commented Feb 24, 2020

Any update on this?

@erezrokah

This comment has been minimized.

Copy link
Collaborator

@erezrokah erezrokah commented Feb 24, 2020

This is next on our list. We needed to pay off some tech debt to make this happen (#3316)

@JeffML

This comment has been minimized.

Copy link

@JeffML JeffML commented Feb 28, 2020

I would hope we could filter by draft/published status as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Priority Issues
Ready For Development
Planning
Backlog
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.