4

I'm using Sitecore 8.2 - update 2.

Scenario: I like to list all of the articles sorted by a Publish Date.

Which is the best practice/approach?

  1. Sitecore's Publishing Setting: Use Sitecore's OOTB Publishing Setting. I can set the from field. In my rendering, I will sort the items based on item.Publishing.PublishDate.

  2. Custom Field: Add a field name 'Publish Date' to the template. Set it as a Date field. After mapping the items to an object, in the IEnumerable, use this field as to Sort.

1 Answer 1

6

For those scenario's I always use a custom field and the reason is rather simple: if your article gets an update (can be for something stupid like a typo) the ootb publish date will change but you probably don't want that effect in your sorting. Well, that's my experience - they (customers) mostly want the original publish date..

It's a choice between something automated and something manual. Involve the customer/editor in this decision:

  • the automated way is less work - although it's not that much work to set "today" in a date field and you could even set it in the standard values
  • the manual way gives them more flexibility (also had cases where the publishing date of the article was not the actual publish date they wanted to see.. )

So as I said, in my experience it always turned out in favor of the date field on the template

5
  • It won't change if you manually set the publishing from date. If you don't, it'll take on the updated date. Commented Nov 8, 2017 at 16:24
  • 1
    If you can get that explained to a content editor, I'm hiring you to do our trainings ;)
    – Gatogordo
    Commented Nov 8, 2017 at 16:27
  • Updated the answer with a bit more reasons why I end up with a template field..
    – Gatogordo
    Commented Nov 8, 2017 at 16:28
  • Love the second comment. Are you guys hiring? ;-) Noted. You're right, the right approach is to get the content editors involved to see which one they favor. Commented Nov 8, 2017 at 16:30
  • We're using SXA and in our page list we went with the custom field to sort articles by date. Worked just as we expected. Commented Nov 8, 2017 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.