Is there a way to change the comma shown in the image below to |

The attribution section of a Leaflet map

I used the QGIS plugin QGIS2WEb to create the Leaflet map and wanted to link to the source of the information.

Currently, in the HTML code I have used the attribution format like so:

var overlay_GoogleHybrid_0 = L.tileLayer('https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}', {
        opacity: 1.0,
        attribution:'<a href="https://google.com" target="_blank">Base Layer Map info &copy; Google</a>',
    });

I am also unsure if this is the correct method of referencing the Google Hybrid layer I am using (Obtained using the Quick Map Services plugin).

up vote 1 down vote accepted

The short answer is no, because that comma is generated by Leaflet itself:

prefixAndAttribs.push(attribs.join(', '));

https://github.com/Leaflet/Leaflet/blob/master/src/control/Control.Attribution.js#L103

The long answer is that, with work, the "qgis2web" part could be moved into the attribution's prefix (ie before the pipe symbol) - in fact that would be quite a good idea, but requires development of the qgis2web plugin itself. Individual layer attributions would still be comma-separated, though.

  • Ok thanks for the quick reply, would be a decent addition as it looks a bit odd without it. – Greg Palmer Nov 12 at 16:47
  • I've made this change to qgis2web master branch. It will be part of the next release of the plugin. – Tom Chadwin Nov 13 at 10:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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