Skip to content

How can I add leaflet support to a HuGo-driven Website or to an Obsidian-publish Site? #395

Answered by valentine195
SpocWeb asked this question in Q&A
Discussion options

You must be logged in to vote

Converting a plugin for use on a published website is a big task, especially if it interfaces with the file api.

You will have to:

  1. Create a browser bundle of the code that includes the leafletjs code, as well as either remove or mock any file API calls
  2. If you have any file-based markers, they will need to be cached and included in the js bundle or removed from the maps
  3. watch for DOM changes to detect a code block decorated as leaflet
  4. Inject the leaflet map and create the markers

I did this for admonitions, which is a simple HTML code block replacement, and it was still hard and didn’t work consistently or like the plugin.

You are welcome to try but I will not be able to offer support.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SpocWeb
Comment options

Answer selected by SpocWeb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #394 on June 09, 2023 18:12.