decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.97k stars 3.05k forks source link

Search, sort, group by template tags in summary #5724

Open martinjagodic opened 3 years ago

martinjagodic commented 3 years ago

It is great that we can add template tags to the summary of a collection entry, for instance {{dirname}} is useful on nested files. However, it is not possible to group, sort, or search by these.

A solution would support template tags in the config for sortable_fields and view_groups and return search results containing tags in the summary.

Proposed config:

collections:
  - name: posts
    label: Posts
    label_singular: post
    folder: content/posts
    path: '{{slug}}/_index'
    summary: "{{dirname}} - {{title}}"
    sortable_fields: ['{{dirname}}', 'title', 'weight']
    view_groups: [
      {label: Category, field: category},
      {label: Directory, field: '{{dirname}}'},
    ]
    fields: [
      {name: title, label: Title, widget: string},
      {name: category, label: Category, widget: string},
      {name: weight, label: Weight, widget: number},
    ]
rohan-kulkarni-25 commented 3 years ago

Hey @martinjagodic , @erezrokah will like to work on this and give my best by adding this feature

VISHESH0932 commented 1 month ago

Hey @martinjagodic ,I would love to work on this issue.

martinjagodic commented 1 month ago

@VISHESH0932 great, you are assigned.

VISHESH0932 commented 1 month ago

@martinjagodic ,Please confirm decap-cms\packages\decap-cms-core\src\reducers\__tests__\entries.spec.js that this is the targated file in which i should make changes in the test should return sorted entries entries by nested field

martinjagodic commented 1 month ago

@VISHESH0932 Yes, that's the file.