0

On my Drupal 8 site, I created pages with a Leaflet card that uses open street map data.

When I go to google search console, it tells me that the following links are blocked "Pages with blocked resources" :

What should I do ?

How to manage external links for SEO?

enter image description here

1 Answer 1

0

If you use Wordpress, there are some plugins adding nofollow to certain, external domains. If no wordpress, try something like this script:

function add_nofollow( $content ) {

    $my_xurl = "*.openstreetmap.fr";
    $my_purl = "*.tile.openstreetmap.fr";
    preg_match_all( '~<a.*>~isU', $content, $uri_match );

    for ( $i = 0; $i <= sizeof( $uri_match[0] ); $i ++ ) {
        if ( isset( $uri_match[0][ $i ] ) && ! preg_match( '~nofollow~is', $uri_match[0][ $i ] )
             && ( preg_match( '~' . preg_quote( $my_xurl ) . '~', $uri_match[0][ $i ] ))
             && ( preg_match( '~' . preg_quote( $my_purl ) . '~', $uri_match[0][ $i ] ))
            ) {
            $uri_change = trim( $uri_match[0][ $i ], ">" );
            $uri_change .= ' rel="nofollow">';
            $content = str_replace( $uri_match[0][ $i ], $uri_change, $content );
        }
    }

    return $content;
}

add_filter( 'the_content', 'add_nofollow' );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.