Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rasmus Olofsson 23 posts 187 karma points c-trib
    Nov 11, 2020 @ 17:38
    Rasmus Olofsson
    0

    How can I order pages in the back office page tree with a custom property? (Published date)

    7.15.6.

    In the page tree in the back office you can sort pages by Creation Date, Name and Sort Order.

    I would like to order the pages with a custom property that gets the current date when the page is published. I have named the property "publishedDate".

    It is okay if it is only possible to hard code sorting by the custom property which will display the latest published page. But it would be preferable if the custom property shows up as an option to sort on in the sorting pane.

    An image of the page tree and it's sorting functionality if the subpages

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Nov 14, 2020 @ 17:32
    Marc Goodson
    100

    Hi Rasmus

    Firstly if this is for a particular area of the site, like a blog, then one option would be to consider making the section a ListView:

    https://our.umbraco.com/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Listview/

    I think this allows you to add custom columns, and 'I think' you can sort by these properties too... https://github.com/umbraco/Umbraco-CMS/pull/711

    If you don't want to use a ListView, then another option would be to handle the TreeController's MenuRendering event: https://our.umbraco.com/Documentation/Extending/Section-Trees/trees-v7#menurendering

    You could look for the core 'Sort' option, when it appears as a Menu option on content items and remove it from the list, and then add your own 'Super Sort' option - pointing to your own custom angular view (you could use the existing core sort angularJS view as a starting point for this) and then implement your own sorting mechnism to support your custom logic.

    Or the other option maybe to handle the ContentService Saving/Saved event, for new content items

    https://our.umbraco.com/Documentation/Reference/Events/ContentService-Events-v7

    to trigger a resorting of the items in the section the item is being published in by your custom date, so the item with the latest published date is always sorted on top.

    regards

    marc

Please Sign in or register to post replies

Write your reply to:

Draft