[Resolved] generatepress category read more Links do not have descriptive text

Home Forums Support [Resolved] generatepress category read more Links do not have descriptive text

Home Forums Support generatepress category read more Links do not have descriptive text

  • This topic has 3 replies, 2 voices, and was last updated 1 month ago by Ying.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2050356
    Melissa

    The category area of my site is returning lighthouse errors…

    missing-text

    “read more Links do not have descriptive text”

    This occurs in every Category page https://www.mydomain.com/category/

    all of the read more links contain a title and an aria, but no description- which causes a penalty in Lighthouse. Ideas on how to fix it?

    Disclaimer: You are not supposed to edit core files, it’s a no-no.

    With that said, I tried altering the inc/structure/post-meta.php (lines 453/481)

    if ( ! function_exists( 'generate_content_more' ) ) {
    	add_filter( 'the_content_more_link', 'generate_content_more' );
    	/**
    	 * Prints the read more HTML to post content using the more tag.
    	 *
    	 * @since 0.1
    	 *
    	 * @param string $more The string shown within the more link.
    	 * @return string The HTML for the more link
    	 */
    	function generate_content_more( $more ) {
    		return apply_filters(
    			'generate_content_more_link_output',
    			sprintf(
    		//this line>//		'<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" aria-label="%4$s">%3$s</a></p>',
    				the_title_attribute( 'echo=0' ),
    				esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
    				__( 'Read more', 'generatepress' ),
    				sprintf(
    					/* translators: Aria-label describing the read more button */
    					_x( 'More on %s', 'more on post title', 'generatepress' ),
    					the_title_attribute( 'echo=0' )
    				)
    			)
    		);
    	}
    }

    This line specifically:
    '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" aria-label="%4$s">%3$s</a></p>',

    to this:
    '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" description="%4$s" aria-label="%4$s">%3$s</a></p>',

    Note the change/addition of: description="%4$s" which is an attempt to use the aria description as a description to appease the lighthouse gods.

    but I suspect I also have to edit this part to get that to work
    _x( 'More on %s', 'more on post title', 'generatepress' ),

    so far no love…
    Thanks

    #2050495
    Ying
    Staff
    Customer Support

    Hi Melisa,

    I think you misunderstood the meaning of “read more links do not have descriptive text” warning, it’s not about if there’s a description added to the HTML, it’s about the word: read more.

    Have a read on these 2 articles I found online:
    https://web.dev/link-text/
    https://altitudemarketing.com/blog/links-do-not-have-descriptive-text/

    Here’s the Source code for Links do not have descriptive text audit: https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/audits/seo/link-text.js

    As you can see, as long as you are using one of below list as your link text (English), the error will occur.

      'click here',
      'click this',
      'go',
      'here',
      'information',
      'learn more',
      'more',
      'more info',
      'more information',
      'right here',
      'read more',
      'see more',
      'start',
      'this',

    So I guess we have to avoid using read more as the button text, but try something more descriptive ๐Ÿ™‚

    #2050868
    Melissa

    Well dang, LOL.. that’s a completely different view from what I was expecting. I’ll try “keep reading”. Thank you for the in-depth explanation

    #2051244
    Ying
    Staff
    Customer Support

    You are welcome Melissa ๐Ÿ™‚

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