Speeding up the WordPress maps loading
ยท One min read
We continue working on increasing the performance of MapSVG. This update adds lazy loading of the maps and changes the way the maps are initialized.
It is highly recommended to use the lazy loading feature if your map is located below the top visible area of your WOrdPress page and is not immediately visible to the user. Example:
[mapsvg id="1" lazy="true"]
This will improve page loading speed and improve website's SEO ranking.
Another important thing is that the map initialization code, which was injected into the page body previously, now is generated on demand. It means a few important things:
- Smaller page size, faster loading;
- Compatibility with WordPress plugins that add page prefetching functionality. When you need to reinitialize the maps on URL change, simply call
MapSVG.loadMaps()
. Also, if needed, you can useMapSVG.unloadMaps()
; - Compatibility with WordPress caching plugins that extract JS code from WordPress pages into separate
.js
files.
The full changelog can be found here