[Resolved] Problem with hatom. Missing author

Home Forums Support Problem with hatom. Missing author

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #308475
    Enrico

    Hi Tom,
    I used your code https://gist.github.com/generatepress/67fb28af5c8be3103290 for a long time.

    Google’s Structured testing tool test was always with 0 errors and 0 warning. But in the Google webmaster console I had always errors in Structured data: missing author errors in category and blog pages.

    I finally understood the problem. With you code all the author information in Hatom was removed in category and blog. Author information was present, but only in Creativework data, this is why it took me so long to understand the problem.

    hatom should have this information:
    author
    @type
    hcard
    fn
    Enrico F
    url
    https://sitename.it/author/ef/
    n

    With you code this information was removed. I think you should remove only the url not the fn.

    Regards
    Enrico

    GeneratePress 1.3.46
    GP Premium 1.2.96
    #308613
    Tom
    Lead Developer
    Lead Developer
    #308638
    Enrico

    Thanks a lot Tom, I tested it and this code don’t remove the hatom for author. it removes correctly only the links to author page in categories, blog and posts.

    The old code was removing also the date link in categories, blog and posts. Is it possible to remove also the date links?

    #308640
    Tom
    Lead Developer
    Lead Developer

    Try this function:

    add_filter( 'generate_post_date_output','tu_remove_date_link' );
    function tu_remove_date_link() {
    	$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
    	}
    
    	$time_string = sprintf( $time_string,
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() ),
    		esc_attr( get_the_modified_date( 'c' ) ),
    		esc_html( get_the_modified_date() )
    	);
    	
    	printf( '<span class="posted-on">%s</span>',
    		$time_string
    	);
    }
    #308663
    Enrico

    Thanks a lot Tom! I added also this code and apparently everything is working. Now also the dates have no links.

    There is something that can have problems with this code and that I have to check more carefully or is the same old code to remove dates links?

    #308780
    Tom
    Lead Developer
    Lead Developer

    These functions I just provided are the latest/greatest way to do it – way better than overwriting the entire function 🙂

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