Sorting attachments

Tomorrow's release of the GOV.UK government app will include the ability to control the order of attachments on a publication page.

This has been one of the most requested features by publishers around government, so we're especially excited about putting this live.

In order to add this feature, and unblock the way for various other improvements to attachments handling, the publishing interface for creating and editing attachments will change significantly for the following 5 document formats from tomorrow:

publications

consultations

statistical datasets

news articles

detailed guides

We hope you'll find the new interface intuitive, but it's a big change so here's a run-through of the main differences.

Own tab

Attachments will now be created (and edited or removed) on a separate tab from the main document. When you go to edit an existing document, you'll now see two tabs at the top like this:

Attachments tab

Select the "Attachments" tab to manage attachments, and the "Document" tab to edit all other content of the page.

You'll need to save any changes you make on either tab before switching to the other one. Don't worry - a pop-up prompt will appear if you have unsaved changes.

New save buttons

An important thing to be aware of is that, when you're creating a brand new document, the attachments tab will not appear until you first complete all mandatory fields and save the draft document.

In other words, you can't attach any files until you've created a draft document to attach them to.

There's a new button to help you with this, called "Save and continue editing". Use this if you want to carry on editing so you can manage attachments. The attachments tab appears after you've pressed the button. (Or if you're done editing, just use the Save button to save and close the document editing view, as usual).

New save buttons

Placing attachments with markdown

On a news article, detailed guide or statistical dataset, you can place the attachments into the relevant part of the body text using markdown commands. Once you've added some attachments, the reference for each attachment is shown below the body field in the middle of the "Document" editing screen, so you can easily copy the appropriate markdown command and add it to your content.

Markdown snippets

Drag and drop sorting

On consultations and publications, on the other hand, attached files are automatically placed onto the page. But now you can control the order in which they are shown.

Go to the attachments tab and drag and drop them into the order you want them to appear on the page, and hit save.

Drag and drop sorting

Unaffected formats

The admin interface for attachments has not yet been changed on these other formats that support attachments:

It's also the beginning of a nicer admin interface for managing documents. We have in mind to split out other parts of the editing screen so that the fields are grouped into more logical steps, and so there's more space for the main text editing window.