Image map functionality for Wagtail through inline SVGs
- Add
wagtail_svgmap
to yourINSTALLED_APPS
- Add a
wagtail_svgmap.blocks.ImageMapBlock()
to aStreamField
in your page class
WAGTAIL_SVGMAP_IE_COMPAT
: Whether or not to wrap the rendered SVGs in special markup for compatibility with legacy Internet Explorers. Enabled by default; disabling leads to slightly nicer markup.
- If
wagtail.contrib.modeladmin
is enabled,ImageMap
objects can be created from the Wagtail admin (look for "Image Maps" in the menu). Once you've selected an SVG file, you can create region objects to set which pages/documents/external URLs each discovered ID should link to.
- Use the Django admin interface to create
ImageMap
objects. Once you've selected an SVG file, you can then set which pages/documents/external URLs each discovered ID should link to.
- In a page that has an
ImageMapBlock
-enabled stream field, select the image map to use. You can also additionally set a CSS class to wrap the field with. Ask your friendly neighborhood designer for more information.
- Use
py.test
for testing.