Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog Posts should display the date published rather than the last modified date. #93

Closed
ErikSolveson opened this issue Jun 14, 2024 · 15 comments

Comments

@ErikSolveson
Copy link

ErikSolveson commented Jun 14, 2024

Description

For all posts we would like the date to be the Publish date of the post rather than the Last modified date (as it currently is). Special care should be taken to ensure this doesn't affect other content types (Pages, licences, meeting minutes, etc.)

https://opensource.org/blog/a-public-forum-to-discuss-the-open-source-ai-definition

Steps to reproduce

One Example:

  1. https://opensource.org/blog/a-public-forum-to-discuss-the-open-source-ai-definition
  2. The date on this post should be Jan 26th. Currently it reads april 11th.
Screenshot 2024-06-14 at 1 23 44 PM

Places where the date shows.

[Zendesk]

@geoffguillain
Copy link
Collaborator

Hey @ErikSolveson,

I have a fix for this but I don't have commit rights on this repo yet, I will ask to be added to create a pull request.

Here are the templates that will be updated:

  1. single blog post: https://opensource.org/blog/a-public-forum-to-discuss-the-open-source-ai-definition
  2. archive page for posts: https://opensource.org/blog/page/4

Dates on the post feed are looking good to me: https://opensource.org/feed

Press mentions are also using the updated dates. Do you want to display the created date for those too?

@ErikSolveson
Copy link
Author

Hi @geoffguillain -

Press mentions are also using the updated dates. Do you want to display the created date for those too?

No lets keep Press as last modified, they clarified that specifically Posts should be Published date and the others should remain unchanged.

Thanks!

@geoffguillain
Copy link
Collaborator

Hey @ErikSolveson

I have updated the blog post single and archive pages to display the published date instead of the updated date.
eg. https://open-source-initiative-development.mystagingwebsite.com/blog/open-source-ai-definition-weekly-update-mar-11

Please take a look and let me know if you have any questions.

@moyvincent
Copy link

Hi @geoffguillain, Thanks for this!

I just checked the Licenses and the Press section to make sure that those still show the "last modified".

I Tested this out by updating a test license and noticed that it shows the "published" which I think should be "last modified".

Special care should be taken to ensure this doesn't affect other content types (Pages, licenses, meeting minutes, etc.)

Can you please confirm if the fix must have affected the Pages, licenses, meeting minutes, etc?

Thank you.

@geoffguillain
Copy link
Collaborator

Hey @moyvincent,

I had a look at your test but I can't see any dates displayed. Could you be more precise about what you are seeing?

If you talk about the listing pages in the admin, they are displaying the published date since this is the default behavior on those admin pages for published posts. Draft on their side shows the Last modified date. I have not touched this core behavior in any way.
eg.:
image

The generated HTML that displays dates on posts looks like this:
<time class="byline--date entry-date published" datetime="YYYYMMDD">_THE DATE_</time>

I can't see this HTML on the page's code source you are mentioning.

Can you please confirm if the fix must have affected the Pages, licenses, meeting minutes, etc?

The condition I have added specifically excludes the post type post meaning only blog posts can be excluded. I can confirm that any other post types (Pages, licenses, meeting minutes) using this template part won't be affected.

$time_string = '<time class="byline--date entry-date published" datetime="%1$s">%2$s</time>';

		// Don't display the updated date for blog posts.
		if ( 'post' !== get_post_type() ) {
			if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
				$time_string .= '<time class="byline--date entry-date published updated" datetime="%3$s">%4$s</time>';
			}
		}

@moyvincent
Copy link

Hi @geoffguillain,

Thank you for this!

My understanding of the issue was that these post types (Pages, licenses, meeting minutes), would show "last-modified" on the "Date" column once updated in the WP-admin but I was wrong 😞.

Thank you for clarifying this.

This looks good and we can move this to Production.

@smaffulli
Copy link
Contributor

Press mentions should not display last modified.

@geoffguillain
Copy link
Collaborator

The fix has been pushed to production.

eg.
https://opensource.org/blog/a-public-forum-to-discuss-the-open-source-ai-definition

Other post types are still using the last modified output:
https://opensource.org/osd

Please take a look and let me know if you have any questions.

@moyvincent
Copy link

Hi @geoffguillain,

Thank you for looking into this.

I will inform the partner of the change in the Zendesk thread and update back here based on the feedback.

@moyvincent
Copy link

Hi @geoffguillain,

We just got feedback from the partner and they would like to allow the Meeting Minutes to display only the Published date.

Example: https://opensource.org/meeting-minutes/2024-05-17

The example has both the published date and the last modified date.

Thank you.

@geoffguillain
Copy link
Collaborator

Hey @moyvincent

I have excluded the Meeting minutes for displaying the updated date.

eg. develop: https://open-source-initiative-development.mystagingwebsite.com/blog/meeting-minutes/2024-01-19

Let me know if I can merge this to the production server.

@moyvincent
Copy link

Thank you @geoffguillain!

We can move this to production.

@geoffguillain
Copy link
Collaborator

The fix has been pushed to production:
https://opensource.org/meeting-minutes/2024-05-17

@moyvincent
Copy link

I have informed the partner about this update and will update here if there is any feedback.

Thanks a lot, @geoffguillain!

@moyvincent
Copy link

Partner confirmed all looks good.
We are goof to close this out!

Thank you @geoffguillain!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants