- This topic has 17 replies, 5 voices, and was last updated 1 year, 11 months ago by
Elvin.
-
AuthorPosts
-
October 18, 2020 at 7:32 am #1494219
Abdul
Right now when I update a post I am getting the updated date in the post but the same is not reflected in the google search results for that post
can you please let me know how to display the updated date in Google search results too.
October 18, 2020 at 9:39 am #1494500Leo
StaffCustomer SupportHi there,
This should help:
https://docs.generatepress.com/article/generate_post_date_show_updated_only/Adding PHP: https://docs.generatepress.com/article/adding-php/
October 18, 2020 at 11:12 am #1494613Abdul
I have added the code using the code snippet. I Will check if it reflects in Google and post the update.
October 18, 2020 at 11:16 am #1494616Leo
StaffCustomer SupportSounds good.
It should 🙂
October 20, 2020 at 2:02 pm #1497651Abdul
the updated page date is not displayed in the google search. Please check the post mentioned in the private information section which was updated on Oct 19 but the search result still shows as Oct 12.
In the sitemap it shows updated on Oct 19
October 20, 2020 at 3:27 pm #1497704Elvin
StaffCustomer SupportHi,
You have to request Google to recrawl your site if you want your changes to reflect immediately.
https://support.google.com/webmasters/answer/6065812?hl=enMay 1, 2021 at 10:20 am #1759418Belinda
Hello,
I wanted the same thing and I addedadd_filter( 'generate_post_date_show_updated_only', '__return_true' );
using the code snippets plugin.
My question is, at the bottom, do I check “Run Snippet Everywhere” ?Will the above work for dates on both posts and pages?
Many thanks!
BelindaMay 1, 2021 at 11:03 am #1759469Leo
StaffCustomer SupportMy question is, at the bottom, do I check “Run Snippet Everywhere”?
Yes 🙂
Will the above work for dates on both posts and pages?
By default, there isn’t a time stamp in the markup of static pages.
May 5, 2021 at 5:19 am #1765434Belinda
Thank you Leo. Highly appreciate your quick response!
BelindaMay 5, 2021 at 11:24 am #1766240Leo
StaffCustomer SupportNo problem 🙂
June 21, 2021 at 9:41 am #1829989Charbel
Hello @Leo,
I have already the following two filters in my functions.php.
/***** Show the "Updated" Post Date in Header Element *****/ function post_modified_date() { return get_the_modified_date(); } add_shortcode( 'modified_date', 'post_modified_date' );
/***** Display updated date for WPSP Posts *****/ add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );
If I add the filter noted in this topic, then the Updated on text is gone from my articles/posts.
/***** Show post updated date in Google Search *****/ add_filter( 'generate_post_date_show_updated_only', '__return_true' );
Is it ok if I add the ‘Updated on‘ text to the filter as follows?
/***** Show post updated date in Google Search *****/ add_filter( 'generate_post_date_show_updated_only', 'Updated on', '__return_true' );
Here is my site for your reference: https://charbelnemnom.com
Finally, which filter should I take out and which one should I keep, so can I show the post Updated date in Google Search, as well as, on my WPSP home page, Blog page, and articles?
Thank You @Leo
June 21, 2021 at 5:32 pm #1830297Elvin
StaffCustomer SupportHi Charbel,
Is it ok if I add the ‘Updated on‘ text to the filter as follows?
/***** Show post updated date in Google Search *****/
add_filter( ‘generate_post_date_show_updated_only’, ‘Updated on’, ‘__return_true’ );No, that won’t work.
Just add this –
/***** Show post updated date in Google Search *****/ add_filter( 'generate_post_date_show_updated_only', '__return_true' );
and add this CSS:
time.entry-date.updated-date:before { content: "Updated on "; }
June 21, 2021 at 10:07 pm #1830425Charbel
Thank you @Elvin, much appreciated!
So, I have added the following two filters to cover all posts/articles and WPSP Posts on the home page as follows:
/***** Display updated date for WPSP Posts homepage *****/ add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );
/***** Show post updated date in Google Search for Posts *****/ add_filter( 'generate_post_date_show_updated_only', '__return_true' );
Then, I have added the CSS you noted above and it works as expected. Thank You!!!
https://charbelnemnom.com/author/charbel-nemnom/ and
https://charbelnemnom.com/microsoft-teams-vs-zoom-how-to-determine-the-right-fit/However, I have removed the previous function below since it’s not needed anymore:
/***** Show the "Updated" Post Date in Header Element *****/ function post_modified_date() { return get_the_modified_date(); } add_shortcode( 'modified_date', 'post_modified_date' );
Could you please confirm?
I would expect that Google search will pick up the updated date and show it once it crawls the articles, right?
Many Thanks, @Elvin!
June 21, 2021 at 10:23 pm #1830433Elvin
StaffCustomer SupportI assume you’re using that shortcode snippet on your header element but I’m not sure.
Try disabling it and see if something disappears.
I would expect that Google search will pick up the updated date and show it once it crawls the articles, right?
That should be the case on pages with updated dates because Google crawler bots will have no way of reading the published date because the only
<time>
tag that renders is the updated date.June 21, 2021 at 10:34 pm #1830437Charbel
Thank You @Elvin!
I have commented out/disabled that shortcode snippet for the header element and nothing gets disappeared. I will keep verifying.
As for Google Search, yes, I am interested in getting the updated date for articles/posts to show up during a search. Because I update my articles regularly and I don’t see the updated showing when I perform a search.
I believe we are all set for now.
Thank You!
-
AuthorPosts
- You must be logged in to reply to this topic.