I need to get the Last Published Date of the Page in Tridion DXA 1.2

When I preview the page in CME, I am seeing an attribute in JSON ouput as below


Value of the attribute is always as above, it is not giving the right value ever and it is not added to the DXA Page Model at delivery side to use it.

So, decided to get the LastpublishedDate from Broker Data Base, Items table.

Is there any DXA OOTB method to get the LastPublishedDate from Broker DB?

  • I'm not surprised it gives you that on preview... have you checked what it contains once it's published? Otherwise, this is available in the page metadata
    – Nuno Linhares
    Sep 30, 2016 at 18:29
  • Once it is published, am not seeing that attribute in my page model. However, I am able to see other details like page revision date in my page model.
    – Jey
    Sep 30, 2016 at 18:35
  • 1
    @Hiren: am using DXA not DD4T in my delivery. I could not use PageMetaFactory because of internal class PublicationResolver : IPublicationResolver in Sdl.Web.Tridion.Mapping namespace.
    – Jey
    Sep 30, 2016 at 20:04
  • As nuno highlighted you can get it from page metadata, this was dd4t way however similar thing should be possible for DXA.
    – Hiren Kaku
    Sep 30, 2016 at 20:23
  • Please clarify why you can not use PageMetaFactory. Oct 1, 2016 at 9:26

1 Answer 1


It indeed seems that Page.LastPublishedDate is never set by DD4T Templates. DXA (currently) also has no OOTB model mapping for this property.

However, it is quite easy to obtain the last publish date using the CD API. Something like:

PageMetaFactory pageMetaFactory = new PageMetaFactory(Convert.ToInt32(localization.LocalizationId));
IPageMeta pageMeta =  pageMetaFactory.GetMeta(Convert.ToInt32(pageModel.Id));
DateTime lastPublishDate = pageMeta.LastPublicationDate;

There is no need to use the DD4T Provider for this purpose.

If you want all your Page Models to have a last publish date set, you could create your own Page Controller: a subclass of DXA's built-in PageController which overrides the EnrichModel method. You can put above logic in that override. You could store the date in PageModel.ExtensionData:

using Sdl.Web.Mvc.Controllers;
using System;
using Sdl.Web.Common.Models;

namespace Example
    public class MyPageController : PageController
        protected override ViewModel EnrichModel(ViewModel model)
            PageModel pageModel = (PageModel) base.EnrichModel(model);

            Localization localization = WebRequestContext.Localization;
            PageMetaFactory pageMetaFactory = new PageMetaFactory(Convert.ToInt32(localization.LocalizationId));
            IPageMeta pageMeta = pageMetaFactory.GetMeta(Convert.ToInt32(pageModel.Id));
            pageModel.SetExtensionData("LastPublishDate", pageMeta.LastPublicationDate);

            return pageModel;
  • BTW: DXA does include the last publish date of Pages in the Navigation Model (try opening /Navigation.json) Oct 3, 2016 at 14:53
  • Thanks Rick, it works. Am able to get the published date from Tridion CD.
    – Jey
    Oct 3, 2016 at 21:05

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.