- This topic has 12 replies, 4 voices, and was last updated 4 years, 7 months ago by David.
-
AuthorPosts
-
September 12, 2019 at 12:41 pm #1008104Stevie
Hi guys
Still working on a test site here with GP. The site I’ll be moving to GP has a heap of posts
going back years. The permalink structure I chose back in the day included the date.
I have two questions.1.
On this test site I added the CSS below to show the last modified date. It shows nicely on the page itself,
but not on Google./* last updated */
.posted-on .updated {
display: inline-block;
}.posted-on .updated + .entry-date {
display: none;
}.posted-on .updated:before {
content: “Last Updated “;
}Is there anything I’m leaving out, as Google isn’t picking that up.
2.
What are your views on the efficacy of changing permalinks on an old site like mine to exclude post dates?
My main site used to rank much higher and now my main visits are to my WP pages which of course have no dates in the urls. Does Google really drop you down in search because of dates?
There is some debate about this and I know I would have to set up a redirect instruction in the htaccess.I would probably be happier to leave well alone, as they go back nearly 10 years, but I would definitely
want to solve the ‘last modified date’ not showing in Google Serps.September 12, 2019 at 12:55 pm #1008115LeoStaffCustomer SupportHi there,
David provided some explanations in the second paragraph here:
https://generatepress.com/forums/topic/using-last-updated-date-in-google-search-and-blog/#post-1007588You could also consider using this snippet so that only the updated date is in the HTML markup:
https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-dateI’d assume Google will pick that up as it’s the only date.
September 12, 2019 at 3:02 pm #1008194JimThis code works for me too.
add_filter( 'generate_post_date_output', function( $output, $time_string ) { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = 'Updated On: <time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); return sprintf( '<span class="posted-on">%s</span> ', $time_string ); }, 10, 2 );
How to add PHP https://docs.generatepress.com/article/adding-php/
September 13, 2019 at 4:19 am #1008516StevieThanks for that Leo. Is that a CSS code I can add in the custom css section of customiser?
September 13, 2019 at 5:48 am #1008570DavidStaffCustomer SupportHi there,
it is a PHP snippet, this article covers that:
September 14, 2019 at 6:20 am #1009275StevieThanks David. I’ll give that plugin a go. Do I need to remove that CSS I am using?
September 14, 2019 at 11:33 am #1009537DavidStaffCustomer SupportYou shouldn’t require the CSS
September 20, 2019 at 1:58 pm #1014833StevieHi guys
I really appreciate your efforts to help me and I want to figure this out.
But the suggestion above doesn’t appear to work. I applied the html markup php snippet, removed the CSS above, cleared the cache and resubmitted sitemap. Now only the original date shows again on Google search.
I ran a test post through Google rich snippets tool and it shows the following:datePublished
2019-01-29T21:58:27+00:00
dateModified
2019-09-20T21:25:28+00:00Is there a proven CSS to work with the html php snippet that will show only updated date in
Google search?
Thanks again for all your helpSeptember 20, 2019 at 5:12 pm #1014893DavidStaffCustomer SupportThe snippet is working as the Post Meta Date is only displaying the Updated Date.
One of your plugins, most likely SEO, is outputing <meta> tags in the <head> of the site for those two dates you see.September 21, 2019 at 7:13 am #1015172StevieI have Yoast SEO. Should I or can I change this, or should I just waits for Google SERP to do its thing?
At present – I am using the suggested html markup snippet, and no CSS added
Google rich snippets tool shows the following:datePublished
2019-01-29T21:58:27+00:00
dateModified
2019-09-20T21:25:28+00:00September 21, 2019 at 7:47 am #1015179DavidStaffCustomer SupportGoogle will choose to display a relevant date based upon many ( unknown ) factors.
One thing it does make clear is it will ignore dates that are not visible on the page itself.
As you’re only displaying the modified date on the post it should pick that date. It may take some time for that change to show.If you really must remove the datePublished then you would need to speak with Yoast.
September 21, 2019 at 10:25 am #1015404StevieThanks David, I think I’ve probably done what can be done at this stage.
Many thanks !September 21, 2019 at 2:36 pm #1015511DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.