Feature Request: Order Article Attachments
Hi, it would be helpful if we had the option to order article attachments the same way we can order subsections and articles when creating new sections (alphabetically, by creation date, or manually).
We have an article where we add a new attachment with updated data each month but also keep several previous versions for insight into what's changed. Having the ability to sort them by month would be great. Thanks!
-
This would be extremely helpful!
-
I request the same feature
-
Exactly what I am looking for right now...
-
Came here looking for this exact same thing. Weirdly they are organised when I edit the article, by name, which is fine since we use version numbers, but on the article that is published they appear random...
-
We would like this as well!
-
Hi Everyone,
As a workaround, here is a piece of Javascript to order attachements by alphabetical order on the front-end of an article:
const reorder = () => {
const frag = document.createDocumentFragment();
const list = document.querySelector(".attachments");
const items = list.querySelectorAll("li");
const sortedList = [...items].sort((a, b) => {
const c = a.textContent,
d = b.textContent;
return c < d ? -1 : c > d ? 1 : 0;
});
for (const item of sortedList) {
frag.appendChild(item);
}
list.appendChild(frag);
}
reorder()You can use this code in the script.js file of your theme, ideally just before the last closing bracket.
If you have a custom theme, please double check that the <ul> tag listing the attachements has still the class "attachements". You can find it in the article_page.hbs file at the line 96 in the default theme (see screenshot attached). If the name of the class was changed, you would need to adjust the third line of the snippet provided above by replacing "attachements" with the new class name.
-
Thanks a lot, Christophe!
Made my life a lot more easy to live... :-)
-
Thanks for this, I have tried adding this as it has been very frustrating not having it, however it has not changed the article, they are still ordered incorrectly. Please advise what I can check? Using the default Copenhagen theme. This is the bottom of my script.js.
And this is my article page where you will see they are still in a different order (ive blocked the first part of the filename, but it is identical), the only difference is the version number at the end, im wondering does your workaround apply to numbers also?
-
thank you for sending this but for my particular role, it would really be helpful to be able to manually re-order the articles in order of importance. right now, when we receive a new version of an important document that should be listed at the top of the documents section, i have to delete all the documents and then re-upload the document in the order of importance.
-
Hi All,
Thank you for your comments and feedback. It's highly appreciated, especially since we are planning to spend some time in the next two quarters bringing some improvements into the area of article attachment management.
Please sign in to leave a comment.
10 Comments