Site logo

[Support request] Last updated – not showing in Google

Home Forums Support [Support request] Last updated – not showing in Google

Home Forums Support Last updated – not showing in Google

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1915655
    Andy

    Hi,
    I have been using this code on a number of articles to show ‘Last updated’ instead of published date:
    }
    .posted-on .updated:before {
    content: “Last updated: “;
    }
    .posted-on .updated {
    display: inline-block;
    }
    .posted-on .published {
    display: none;
    }

    However, I now realise that this doesn’t affect what is shown in Google and it’s important for these articles to appear current in the SERPS.
    How do I change it so the ‘Last updated’ date appears in Google instead of the published date?

    Thank you,

    #1915664
    Ying
    Staff
    Customer Support

    Hi Andy,

    You can try this PHP snippet:
    https://docs.generatepress.com/article/generate_post_date_show_updated_only/

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

    Hope it’s helpful 🙂

    #1915681
    Andy

    Hi,
    Am I right in assuming the code you attached will do what is already being done? i.e. hide the ‘published’ date and only show ‘Last updated’?

    For example, in the url attached, it already shows last updated using the css i attached. But Google only shows the date published. In Source, I can see both dates?

    Thank you,

    #1915687
    Ying
    Staff
    Customer Support

    The PHP snippet is NOT doing hiding, but doing removing, which is different from what CSS does.

    With the PHP snippet, if there’s an updated date, then the published date won’t show up in HTML.

    Hope I made it clear.

    #1915702
    Andy

    Hi,
    Yes, that makes it more clear. This PHP code you sent will remove the published date so only the last updated shows up.
    If I add this PHP using the code snippets plug in, should I then remove the CSS code i originally pasted from all the articles?
    Thank you,

    #1915731
    Ying
    Staff
    Customer Support

    You can remove the CSS and you won’t need the CSS for the hiding published date purpose.

    But if you want to add prefix: “last updated:” before the updated date, we can have a look later and provide another set of CSS.

    Let me know 🙂

    #1915872
    Andy

    Hi,
    thanks for your reply.
    Yes, i’d like to add “last updated”…
    How shall i go about this?
    Thanks,

    #1915907
    Ying
    Staff
    Customer Support

    Give this CSS a try:

    .inside-article .posted-on .updated-date:before{
        content: "Last Updated: ";
    }

    If it doesn’t work, you can link us to the site after you implanted the PHP snippet and clear cache 🙂

    #1916249
    Andy

    What will happen to articles which have never been updated? Will their published date still show? Or is that now hidden too?
    Thanks

    #1916488
    David
    Staff
    Customer Support

    Hi there,

    articles that have never been updated will display the published date.

    #1920221
    Andy

    Hi, thank you for your quick responses.
    I have added the snippet and the css and all works perfectly (thank you very much),
    But, can I just triple check one last thing: I checked the url on https://validator.schema.org/ and under CreativeWork I noticed the published date has been removed and it only shows date modified. Will this not cause confusion for Google?
    Thank you,

    #1920286
    David
    Staff
    Customer Support

    Thats correct the Snippet removes any HTML/Meta for the second date.
    I can’t say how google decides on what date to display, they like to keep the algorithms a mystery.
    But the best results are seen when there is a single date in the schema and that same date is displayed on the frontend. It removes any option for Google to choose the wrong date from the site. But it doesn’t meant that google will.

    For best results to get your dates in the SERPs is to use a JSON-LD plugin or SEO plugin that does that for you, that will ensure Google gets the exact info its looking for.

    #2441554
    John

    Hi Ying, I followed this tips but I’d like to add some text before the date ” Last Updated On”
    I tried this
    .inside-article .posted-on .updated-date:before{
    content: “Last Updated: “;
    }

    but it doesnt work for me. was hopping you could help

    #2441924
    Ying
    Staff
    Customer Support

    Hi John,

    Can you open a new topic and link us to an article that’s been updated?

    Let me know 🙂

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