[Resolved] Schema markup for datePublished and dateModified

Home Forums Support [Resolved] Schema markup for datePublished and dateModified

Home Forums Support Schema markup for datePublished and dateModified

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #783690
    Nacho

    Hello Tom,

    I was wondering how could I set the markup for datePublished and dateModified.

    In the URL below, if you test it with the tool https://search.google.com/structured-data/testing-tool?hl=es# you´ll see that there is no markup.

    Thanks a lot for your help.

    #783868
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    It looks like you have the post date option turned off in Customize > Layout > Blog.

    If you turn that back on, you should be good to go.

    #783920
    Nacho

    Hello Tom,

    I don´t want to show it to the front end user, just so crawlers can see it. Also activating that feature you just see the published date not the updated date.

    How can I get this?

    Thanks a lot.

    #784129
    Tom
    Lead Developer
    Lead Developer

    Crawlers actually won’t use it unless it’s visible to the user, as far as I understand.

    However, I suppose you could enable it in the Customizer, then hide it with CSS:

    .posted-on {
        display: none;
    }
    #784543
    Nacho

    Hello Tom,

    Actually it doesn’t matter if you show up in your page for crawlers to crawl it.

    Anyway, how can I get the last updated/modified date to show?

    Thanks a lot.

    #784801
    Leo
    Staff
    Customer Support
    #784804
    Tom
    Lead Developer
    Lead Developer

    If you want the markup to be in your source code, enable the date in Customize > Layout > Blog.

    Then use the CSS I provided above to hide it from users.

    If you want to display the updated date to your users, the link Leo shared above is the way to go 🙂

    #786150
    Nacho

    Hello Tom and Leo,

    That worked perfectly.

    Also, how do I remove the date links? and also how do I remove the marging on posts that I´ve hidden the date like in the URL that I´ve just updated for this topic?

    Basically I want to remove the links of the dates and remove the metadata of specific categories (but I´ve seen that with the code below there is still a margin).

    .category-categoryXXX .entry-meta {
        display: none;
    }

    Thanks a lot.

    #786416
    Tom
    Lead Developer
    Lead Developer

    This should help: https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date

    That CSS should remove the margin. Is there a specific page where I can see it?

    #786443
    Nacho

    Hello Tom,

    Thanks for the date link, I´m gonna try right now.

    About the CSS, yes you can see it in the page that I´ve attached to this topic.

    Thanks.

    #786487
    Nacho

    Hello Tom,

    I´ve just tested the link code https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date, but it freezes wordpress and does not work actually.

    I´ve used this code:

    add_filter( 'generate_post_date_output','tu_remove_date_link', 10, 2 );
    function tu_remove_date_link( $output, $time_string ) {
    	printf( '<span class="posted-on">%s</span>',
    		$time_string
    	);
    }

    Is that code ok?

    Thanks a lot.

    #786630
    Tom
    Lead Developer
    Lead Developer

    Looks good to me – how are you adding it?

    #787975
    Nacho

    Hello Tom,

    I´m adding it with the “Code Snippets” plugin but whenever I click the save button WordPress gets blocked.

    I´ve tested in other sites and it happens the same.

    Let me know what I can do.

    Thanks a lot.

    #787992
    Nacho

    Hello Tom,

    Weird thing: WordPress freezes when adding saving the code, then you refresh the page, WordPress comes back and the code actually is working right now.

    Well, if it works 🙂 I don´t if you want me to digg in a little bit.

    Thanks a lot.

    #788104
    Tom
    Lead Developer
    Lead Developer

    I’ve heard that Code Snippets has been doing that lately – hopefully they get it fixed soon.

    Glad the code worked 🙂

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