Site logo

Archived topic

Last Update date do not update in google search snippet

9 replies · Started by John on November 10, 2017

Viewing posts 1–10 of 10

Hey

I want to display Last Update date in my post and also google search snippet. For this, I added that CSS in my child theme stylesheet

------------------------------------

.posted-on .updated {
display: inline-block;
}
.posted-on .published {
display: none;
}

.posted-on .updated:before {
content: "Last updated: ";
}

------------------------------------

Everything was fine. Display Last Update Date in my posts and few days later after recrowl googlebot It will show also in google search snippet.

But from last 2-3 days, I notice show published date in google search snippet again but in my posts show Last Update date.

I mean Last Update date in google search not stay. After Few days display post published date.

Please check both screenshots for better understand my problem.

https://prnt.sc/h8t0rm
https://prnt.sc/h8t1o3

How Can I solve this?

This issue is very important for my site.

Thanks

I check structure data "hatom" tab and find here is display

Link - https://search.google.com/structured-data/testing-tool?url=https://thedearlab.com/best-knee-pads/#url=https%3A%2F%2Fthedearlab.com%2Fbest-knee-pads%2F

Screenshot Link - https://prnt.sc/h8vbyp

.posted-on .published {
display: none;
}

This CSS property display none I mean hide published date from my website posts but not able to hide from structure data. Maybe for this reason on google search result show published date. Not sure, you are expert so you can find a proper reason.

If It is right point, how can I hide published date from structure data?

It looks like the last update date is displaying fine, and the structured data looks fine (the testing tool shows the last updated date just fine).

In this case I think it's just up to Google to display the updated date over the published date - the best thing you can do is add structured data to the elements, which you've already done.

Hey Tom

Is It possible to keep only Update date in markup?

I do not want to keep published date because I monitor my keyword on google last few days.

WHen shows Update date in search snippet keyword ranked up.
So I am very tense about this issue.
And I see few site html markup who do not use published date like

https://www.cloudliving.com/seo-powersuite-review/

Is It any problem If I do not use published date?

Please send me code like my current format

Last Update Date | Author image | Author name

Thanks

Are you currently using any code for the byline? I see you have the gravatar in there, so it would be best if I could see what you have already and edit it.

Let me know :)

Hey Tom

Here is the code

----------------------------------------------------------

add_filter( 'generate_post_author_output', 'tu_add_author_gravatar' );
function tu_add_author_gravatar() {
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<span class="author-name" itemprop="name">%3$s</span></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() ),
get_avatar( get_the_author_meta( 'ID' ) )
)
);

}

Try adding this function:

add_filter( 'generate_post_date_output', 'tu_no_published_date' );
function tu_no_published_date() {
    $time_string = '';
    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string .= '<time class="updated" datetime="%1$s" itemprop="dateModified">%2$s</time>';
    }

    $time_string = sprintf( $time_string,
        esc_attr( get_the_modified_date( 'c' ) ),
        esc_html( get_the_modified_date() )
    );

    printf( '<span class="posted-on">%1$s</span>',
        sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
            esc_url( get_permalink() ),
            esc_attr( get_the_time() ),
            $time_string
        )
    );

}

Wow! It works like a charm. You are really helpful.

Thank you so much, Tom

You're very welcome :)

This archived topic is closed to new replies.