[Support request] Last Modified Date In Google Search

Home Forums Support [Support request] Last Modified Date In Google Search

Home Forums Support Last Modified Date In Google Search

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1008104
    Stevie

    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.

    #1008115
    Leo
    Staff
    Customer Support

    Hi 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-1007588

    You 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-date

    I’d assume Google will pick that up as it’s the only date.

    #1008194
    Jim

    This 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/

    #1008516
    Stevie

    Thanks for that Leo. Is that a CSS code I can add in the custom css section of customiser?

    #1008570
    David
    Staff
    Customer Support

    Hi there,

    it is a PHP snippet, this article covers that:

    https://docs.generatepress.com/article/adding-php/

    #1009275
    Stevie

    Thanks David. I’ll give that plugin a go. Do I need to remove that CSS I am using?

    #1009537
    David
    Staff
    Customer Support

    You shouldn’t require the CSS

    #1014833
    Stevie

    Hi 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:00

    Is 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 help

    #1014893
    David
    Staff
    Customer Support

    The 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.

    #1015172
    Stevie

    I 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:00

    #1015179
    David
    Staff
    Customer Support

    Google 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.

    #1015404
    Stevie

    Thanks David, I think I’ve probably done what can be done at this stage.
    Many thanks !

    #1015511
    David
    Staff
    Customer Support

    You’re welcome

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.