Contentful logo

Contentful Community

Set content order of entries

Hi there.
Is it possible to set the order of content entries in the backend for example with drag and drop?

1 Like

Hi @moritz.guehring,

I’ve just confirmed and, in short, the order that is set in your array of references will determine the order of your JSON response.

So, if you have an array of referenced items such as:

[
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryA"}},
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryB"}},
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryC"}}
]

You can rearrange the order by sending a PUT update request with your new desired order in your JSON payload:

[
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryC"}},
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryB"}},
  {"sys": {"type": "Link", "linkType": "Entry", "id": "EntryA"}}
]

Let me know if that helps with your question :slight_smile:

Hi @gabriel,
I think my question wasn’t that good :sweat_smile:
I wanted to know if there is a possibility to arrange the order of entries in the web app.
I now created a new content type with a Reference many field, so in the content view i have now the possibility to arrange the assigned entries with drag and drop.
Let me know if there is a smarter solution, otherwise i solved my problem :slight_smile:

Hi @moritz.guehring,

I think I’m a bit confused here. :smile:

In the Web Interface, it would also be possible to establish the order of your referenced entries by dragging and dropping these items.

For example, I have multiple_references field with the following order in the Web Interface and JSON response:


By moving these items, clicking in the three dots icon, the new established order will also be displayed in the JSON response:


Does that make sense? Let me know if I’m missing something :sweat_smile:

@gabriel I have the same issue/question
I guess what @moritz.guehring is talking about is the Content (entries reordering) not Content model.

Thanks !

2 Likes

We handle this by adding an order field to the content model. We use large integers to start (100, 200, 300, etc) so there is space insert new content between existing entries. If I wanted to add a new entry between 100 and 200 I would enter 150 in the order field.

When making API request you can use the order parameter to order the response by the order field (order=fields.order).

1 Like

That’s way too manual. It would be nice if we can reorder our entries with drag and drop.

1 Like

The solution Gabriel is saying is basically the way I handle this issue, by creating a new content type named “List” with a multiple entries link field. Then I can link my entries in this list and reorder them by drag and dropping, and then fetch this list. But I agree that having this feature directly in the entries view would be soooo great.

I think this is a really important feature! We and our clients would be really happy to have this! :slight_smile:

This is really kinda nuts. The idea of a content management system is to make it easy for non developers to organize, utilize and even customize content. There should absolutely be a way to easily drag/drop the order of JSON data without going into the code.