- This topic has 3 replies, 2 voices, and was last updated 3 years, 4 months ago by
David.
-
AuthorPosts
-
December 3, 2022 at 2:04 pm #2448412
Jessica
Hi! I’m wondering if it’s possible for both (1) a post’s updated date to be exclusively present in the html; and (2) both the original published date and the updated date to be visible at the top of every post.
I first tried adding this CSS & clearing my server’s cache, with zero results on my site:
/* Display updated date */
.posted-on .updated {
display: inline-block;
margin-right: 1em;
}
/*Add date prefixes */
.posted-on .updated:before {
content: ‘Updated: ‘;
}
.posted-on .entry-date:before {
content: ‘Published: ‘;
}(I do have header elements running, for Google Analytics and Google Tag Manager click-thru tracking; would that possibly interfere?)
After that, I found the filter generate_post_date_show_updated_only for hiding the published date in the html, which worked well to show only the updated date in each post.
Let me know if I might be able to add some other code to get both dates visible in my posts;
Thanks so much for the fantastic support!!!December 4, 2022 at 5:42 am #2448945David
StaffCustomer SupportHi there,
i am a little confuse ( which is quite common for me lol ).
As you cannot show both dates ( published and updated ) on the front end, but only have the updated date in the HTML. For them both to be visible they both have to be in the HTML.
Are you wanting both dates to be visible on your site, but have google always use the updated?December 4, 2022 at 12:46 pm #2449394Jessica
Ha, thanks for the humor.
“Are you wanting both dates to be visible on your site, but have google always use the updated?”
That was my original idea;
But after some research, I think it’s optimal to prioritize the updated date for SEO purposes; to make sure each post is appearing fresh, and only update when I have substantive changes.
And I assume it’s simpler; that’s not gonna involve some complicated work-around to try to make Google not show the publish date in serps.
Thank you! Now I’m just curious why I can’t get other CSS to work to change a WP table header color; will open a new thread about that!
December 5, 2022 at 3:36 am #2450033David
StaffCustomer SupportYou can add the PHP Snippet provided here:
https://docs.generatepress.com/article/generate_post_date_show_updated_only/
That will display only a single date, either the published ( when there has been no updates ) or the updated date.
-
AuthorPosts
- You must be logged in to reply to this topic.