Publish Date, Last Updated, Query Deserves Freshness, & Google Fresh Rank

Joined
Jul 26, 2019
Messages
36
Likes
24
Points
0
I checked some of those results. It's Javascript and JSON objects being exposed within visible HTML for one of two reasons: 1) They broke their HTML code so everything past the error is rendering or 2) They pasted their JS scripts into <div style="display:none;"> instead of <script> tags.
Thanks for looking into this, and you're right. To be honest I'm a bit baffled, especially by this one
PHP:
<div style="display:none;">
        WP_Query Object
    (
        [query] => Array
            (
                [post_type] => producten
                [posts_per_page] => 12
                [paged] => 1
                [post_status] => publish
                [orderby] => menu_order
                [order] => ASC
                [suppress_filters] => 0
            )

        [query_vars] => Array
            ( ...
Guess there is an opportunity to make some quick cash if needed...

On topic

Google prefers JSON-LD, at least according to their own docs. Would be nice to test this and see what result you'll get with leaving the JSON output from Yoast in tact.

And at the risk of offending you, at the moment I'm thinking of implemente this. Just want to make sure that the theme displays the original date ( if ! ) or displays the changed date when it, well, changed.

For now I prioritize the ( if ) clause, because I expect changes to happen more then leaving the articles "as is."

PHP:
<?php
if ( get_the_modified_time( get_option( 'date_format' ) ) !== get_the_time( get_option( 'date_format' ) ) ) :
    ?>
    <span class="meta meta-modified">
        <span class="screen-reader-text"><?php esc_html_e( 'Post modification date', 'themename' ); ?></span>
        <a href="<?php the_permalink(); ?>"><?php the_modified_time( get_option( 'date_format' ) ); ?></a>
    </span>
    <?php
else :
    ?>
    <span class="meta">
        <span class="screen-reader-text"><?php esc_html_e( 'Post date', 'themename' ); ?></span>
        <a href="<?php the_permalink(); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a>
    </span>
    <?php
endif;
?>
 

Ryuzaki

お前はもう死んでいる
Staff member
BuSo Pro
Digital Strategist
Joined
Sep 3, 2014
Messages
4,206
Likes
8,081
Points
8
@DanSkippy, your last code block is what I do in the HTML. I previously was removing all mentions of published or modified date in the Open Graph schema though. I'm going to leave it now as a test and see if I can still get Google to trigger freshness.

In your code block, you don't need to do an if check to see if the modified date matches the published date. The published date will never change unless you manually change it. When you first publish, it will match the modified date. But when you update a post (without manually changing the published date), the modified date updates (and the published date doesn't). So if you choose to only display the modified date, it'll match the publish date until you update the post.

Oh, though... I see that you're changing the label from "Post date" to "Post modification date". I just start with "Last updated" and leave it that way, because it's also true even if it's only the publish date that hasn't been modified yet.

Either way gets the job done. Yours is a bit spiffier in that you change the label.
 
Joined
Jul 26, 2019
Messages
36
Likes
24
Points
0
"Last updated" and leave it that way, because it's also true even if it's only the publish date that hasn't been modified yet.
True. Haven't thought about that. Guess I like to geek-out a bit to much...

Yours is a bit spiffier in that you change the label.
Thanks, but I still have a long way to go to out-spiffy you, Sensei.
 
Joined
Sep 3, 2015
Messages
429
Likes
197
Points
1
I disable Yoast schema completely with this and hardcode it with WP functions myself

Code:
// Disable YOAST Schema
add_filter( 'wpseo_json_ld_output', '__return_false' );
 
Joined
Feb 9, 2015
Messages
37
Likes
20
Points
0
It baffles me you guys are still using Yoast.

IMHO Yoast is an inferior SEO plugin.

I'm using The SEO Framework or SEOpress on my sites. Check them out, you won't regret it.