[Resolved] Schema.org markup

Home Forums Support Schema.org markup

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #796349
    Edin

    Hello,

    I’ve been informed by a SEO person that I need to improve the schema markup on my site.

    He said that my theme displayed “WPSideBar,” “WPHeader” markup, which was useless and should be removed.

    Also, I should change the markup from “CreativeWork” to “Article,” and display “datepublished” and “daterevised” (in the markup).

    How can I do all that? Can you point me in the right direction?

    Thanks in advance,
    Edin

    GeneratePress 2.2.1
    GP Premium 1.7.7
    #796776
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    To remove that microdata, you can do this:

    add_filter( 'generate_header_microdata', '__return_empty_string' );
    add_filter( 'generate_sidebar_microdata', '__return_empty_string' );

    Then to change the type of the content, you can do this:

    add_filter( 'generate_article_itemtype', function() {
        return 'Article';
    } );

    The date and modified date should be in the markup by default when using posts.

    #796834
    Edin

    Thank you, Tom.

    The date and modified date should be in the markup by default when using posts.

    I only see “dateModified” in the “Structured Data Test Tool.” Do I have to actively display it in the post in order to have it in the markup (because I only display the “updated date”)?

    And if yes, is there a way to not display it, but have it in the markup?

    #796847
    Edin

    I see it in the source code of the article:

    <meta property="article:published_time" content="2018-10-19T10:00:30+00:00" />
    <meta property="article:modified_time" content="2019-01-23T15:53:15+00:00" />

    But it doesn’t display in the test tool.

    #796999
    Tom
    Lead Developer
    Lead Developer

    Can you link me to the page you’re testing?

    #797021
    Edin

    I’ve edited the first post and put the URL in there.

    Thanks,
    Edin

    #797078
    Burt

    @edin

    Like many things in SEO and the web the “best practices” aren’t necessarily correct and often can be a waste of time in that they don’t really deliver the results expected – schema is one of those things that really depends on how granular you are going – lots of talk of it not being around for the long term.

    As for the article vs creative works here is an article

    https://www.similartech.com/compare/article-schema-entity-vs-creativework-schema-entity

    I would recommend JSON-LD instead of modifying the HTML itemScope, itemType properties etc – Google recommends this route too.

    #797173
    Tom
    Lead Developer
    Lead Developer

    It looks like the published date has been removed from the HTML. Maybe you’re using a custom function?

    JSON-LD might be worth checking out, too. If you go that route, there are a few really good plugins out there. Then you can disable the microdata like this:

    add_filter( 'generate_schema_type', '__return_false' );

    #797186
    Burt

    It has been my experience that the schema will not validate without an article date with this tool ( that historically hasn’t been fun to use )

    https://search.google.com/structured-data/testing-tool/u/0/

    Google has written that it recommends JSON-LD – though it will accept all types of schema. Bing now reads JSON-LD which was an issue for a while

    https://developers.google.com/search/docs/guides/intro-structured-data

    In a recent webmaster video with John Muller, he said that you should only embed JSON-DL regarding locations etc in one page where it makes sense and that reviews should be only on a page that is specific to the reviews.

    If you look at plugins like Yoast SEO they too embedded schema and other plugins do too. It seems that there are a lot of “clashing” of schema – My experience in the past it was easy to spam the schema to get rich snippets in the SERPs but it is not so now and that because it was so difficult to get the HTML schema to validate for the average webmaster and the clashing of different types on the page and the overly complex nature is that Search Engines are moving away from it and focusing more on the authors Expertise, Authority, and Trustworthiness ( E-A-T ).

    I am not saying that schema is not a good idea to ‘help’ the search engines, I just don’t believe one should put a lot of work into it or go to ‘crazy’ as I believe there are other on and off page tasks that will be more beneficial – especially if your content is not geared to schemas like recipes, movie list, restaurants, etc

    #797953
    Edin

    @Tom

    I don’t see anything in the functions.php that could prevent the published date from displaying:

    <?php
    /**
     * GeneratePress child theme functions and definitions.
     *
     * Add your custom PHP in this file. 
     * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
     */
    
    function generatepress_child_enqueue_scripts() {
    	if ( is_rtl() ) {
    		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
    
    // Adds a "after content" widget
    function my_register_sidebars() {
        register_sidebar(
            array(
            'id' => 'after_content_sidebar',
            'name' => __( 'After Content Container' ),
            'description' => __( 'Adds a widget right after each article.' ),
            'before_widget' => '<div id="%1$s" class="widget %2$s">',
            'after_widget' => '</div>',
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>'
        ) );
    
    }
    add_action( 'widgets_init', 'my_register_sidebars' );
    
    // Add Read More Button
    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
    	$output = $excerpt;
    	
    	if ( has_excerpt() ) {
    		$output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">Read more</a></p>',
    			$excerpt,
    			get_permalink()
    		);
    	}
    	
    	return $output;
    }
    
    add_action( 'after_setup_theme', 'tu_move_footer_entry_meta' );
    function tu_move_footer_entry_meta() {
        if ( ! is_singular() ) {
            remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
            add_action( 'generate_after_entry_header', 'generate_footer_meta', 2 );
        }
    }
    
    ?>

    I have this in “Elements” to display below each article headline:

    <div class="entry-meta">by <?php the_author(); ?>, <?php echo do_shortcode( '[est_time]' ); ?> read, <?php comments_number( 'no responses', 'one response', '% responses' ); ?>, updated on <span class="date updated published"><time datetime="<?php the_modified_time('Y-m-d'); ?>" itemprop="dateModified"><?php the_modified_time('M jS, Y'); ?></time></span></div>

    Also, could this setting in the customizer maybe be the problem?

    screen

    Thanks,
    Edin

    #797962
    Edin

    @Burt

    Thank you for taking the time to explain.

    I know what you mean, I take advice from “SEO Experts” with a grain of salt. But fact is, I’ve done EVERYTHING to restore my rankings (fell from 6000 daily to 200 in 2 years), and nothing worked. This is kind of the last thing on my list before I give up on SEO.

    So are you saying this is not worth the effort?

    Thanks again,
    Edin

    #797993
    Burt

    @Edin

    That is tough –

    … fell from 6000 daily to 200 in 2 years …

    Honestly, Edin, if you lost 96% of your traffic over a 2-year period time adding schema markup IMO, is not going to do much for you.

    If you want, PM me at runner2009@gmail.com and I can take a look at your situation quickly. Do you have the basics GA and GSC?

    PS as for the post date, there may be a plugin that is hiding it – Yoast comes to mind

    #798001
    Edin

    @Burt

    That’s very kind of you Burt, thank you.

    Will send the email…

    #798173
    Tom
    Lead Developer
    Lead Developer

    This code you’re using doesn’t have the published date added:

    <div class="entry-meta">by <?php the_author(); ?>, <?php echo do_shortcode( '[est_time]' ); ?> read, <?php comments_number( 'no responses', 'one response', '% responses' ); ?>, updated on <span class="date updated published"><time datetime="<?php the_modified_time('Y-m-d'); ?>" itemprop="dateModified"><?php the_modified_time('M jS, Y'); ?></time></span></div>

    You’d need to add something like this:

    <time style="display: none;" class="entry-date published" datetime="<?php echo get_the_date( 'c' ); ?>" itemprop="datePublished"><?php echo get_the_date(); ?></time>

    #798433
    Edin

    Perfect Tom, that did the trick.

    Thank you!!!

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