Forum

Thread tagged as: Question, Blog

Last modified for blog posts and list/details items

Hi Guys,

Is it possible to get the last modified date for blog posts and list and detail individual items, I know there is a perch_page_modified() tag, but this only gets the individual page date. So in the instance of the blog it would get the post.php page.

Looking to add in a last modified header so that search engines can see this and also utilise this when building XML sitemaps on the server.

Thanks Terry

Terry Upton

Terry Upton 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the postDateTime not the last modified date for a blog post?

Yes I guess it it. What about list item pages?

Drew McLellan

Drew McLellan 2638 points
Perch Support

You'd need a dated item of content for those.

Is there a way to set the date in the backend to change to today's date when you click to edit/save the page? Could I pass this in with a variable? Would that only be applied on save?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The page has a modified date, yes - that's where you started from.

What you really need is a date on the content.

Yes sorry not been clear. What I meant was if I added a date on the content that that date field could be automaticallly updated to today's date/time when you go to edit the page in the admin panel, otherwise I think it would store the date set when you originally create the content.

Not a big issue, just tying to cut out manual work and explore new things/ways of working.

Or what would be useful is a perch_page_modified but for each item in the list/details page. Just throwing that into the mix. Probably an edge case though.

I had the same issue, as I needed the modification date for each list/detail item to create an Atom feed. I solved it by creating a simple new field type that always saves the modification date.

In case anyone else wants to use it, I created a gist for it:

Thanks Manuel. The link seems to be broken though. But this would be a useful field type.

Fixed it, apparently you cannot use markdown links for gists in this forum.