- This topic has 22 replies, 3 voices, and was last updated 4 years, 4 months ago by
Tom.
-
AuthorPosts
-
January 16, 2019 at 7:09 am #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.
January 16, 2019 at 10:05 am #783868Tom
Lead DeveloperLead DeveloperHi 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.
January 16, 2019 at 11:03 am #783920Nacho
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.
January 16, 2019 at 2:57 pm #784129Tom
Lead DeveloperLead DeveloperCrawlers 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; }
January 17, 2019 at 6:33 am #784543Nacho
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.
January 17, 2019 at 8:52 am #784801Leo
StaffCustomer SupportThis should help:
https://docs.generatepress.com/article/show-the-updated-post-date/January 17, 2019 at 8:54 am #784804Tom
Lead DeveloperLead DeveloperIf 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 🙂
January 19, 2019 at 4:36 am #786150Nacho
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.
January 19, 2019 at 9:22 am #786416Tom
Lead DeveloperLead DeveloperThis 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?
January 19, 2019 at 10:16 am #786443Nacho
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.
January 19, 2019 at 11:02 am #786487Nacho
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.
January 19, 2019 at 4:21 pm #786630Tom
Lead DeveloperLead DeveloperLooks good to me – how are you adding it?
January 21, 2019 at 7:14 am #787975Nacho
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.
January 21, 2019 at 7:30 am #787992Nacho
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.
January 21, 2019 at 9:26 am #788104Tom
Lead DeveloperLead DeveloperI’ve heard that Code Snippets has been doing that lately – hopefully they get it fixed soon.
Glad the code worked 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.