bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
140 stars 71 forks source link

Obfuscate the tile url in JavaScript to prevent google indexing... #187

Closed bozdoz closed 1 year ago

bozdoz commented 1 year ago

From: https://wordpress.org/support/topic/tile-url-crawled/#post-16291620

If any of the developers of this plugin read this, please can they incorporate this in their next update so that search engines stop indexing the baseUrl?

Change line 317 of /shortcodes/class.map-shortcode.php from ..

var baseUrl = '<?php echo filter_var($tileurl, FILTER_SANITIZE_URL); ?>';

… to …

var baseUrl = atob('<?php echo base64_encode(filter_var($tileurl, FILTER_SANITIZE_URL)); ?>');

Thank you,

Oliver

webd-uk commented 1 year ago

Thanks! This would be appreciated!

Oliver

hupe13 commented 1 year ago

Should this be an option or apply to all tile servers?

webd-uk commented 1 year ago

Well, Google Search Console pick up the URL and push out the following error(s) ...

Blocked due to other 4xx issue These pages aren't indexed or served on Google LEARN MORE First detected: 10/4/22 Examples URL Last crawled /wp-admin/admin-ajax.php?action=tourist_leaflet_js_tile&subdomain=%7Bs%7D&z=%7Bz%7D&x=%7Bx%7D&y=%7By%7D Sep 30, 2022

... because we use an ajax callback to serve the tiles. It assumes it's a page on the site that can be indexed. Which it isn't and despite the page returning NOINDEX headers, Search Console persists in trying.

So it would be great if the URL were obfuscated to prevent Google (and other search engines) from seeing it.

I'm not sure what impact revealing the URL for third party tile servers would be but clearly Google (and probably other) search engine spiders pick up on it so at the very least it is causing the URL to be requested un-necessarily and with 20,000+ installations of the plugin, that's a significant amount of traffic that could be prevented.

So I say apply to all tile servers.

Oliver