Add "footnote" to the "plugins" setting. You can optionally define the button's position in the toolbar with the "footnoteAddAfter" setting.
"plugins": ["footnote"],
"footnoteAddAfter": "lists",
{% do parseFootnoteDefinitions(entry.footnotes) %}
{{ entry.text|parseFootnoteMarkers }}
{{ getFootnotesHtml() }}
{% do parseFootnoteDefinitions(entry.footnotes) %}
{{ entry.text|parseFootnoteMarkers('_includes/footnotes/marker') }}
{{ getFootnotesHtml('_includes/footnotes/list') }}
{% for entry in entries %}
{% do parseFootnoteDefinitions(entry.footnotes, entry.slug) %}
{{ entry.text|parseFootnoteMarkers(null, entry.slug) }}
{{ getFootnotesHtml(null, entry.slug) }}
{% endfor %}
{% for block in blocks if block.type == 'footnotes' %}
{% do parseFootnoteDefinitions(block.footnotes) %}
{% endfor %}
{% for block in blocks if block.type != 'footnotes' %}
{% if block.type == 'text' %}
{{ block.text|parseFootnoteMarkers }}
{% endif %}
{% endfor %}
{{ getFootnotesHtml() }}
{% do setFootnoteDefinitions({
a: 'My footnote',
b: 'Another footnote',
}) %}
{{ text|parseFootnoteMarkers }}
{{ getFootnotesHtml() }}
Note: Twig doesn’t allow to set and merge hashes with numberical indexes. To work around that issue and still allow to use numberical footnote definition indexes, prefix your numbers with ಠvಠ
before passing them to setFootnoteDefinitions
. The plugin will strip these ASCII characters, and they will get matched to the corresponding numerical marker indexes.
{% set definitions = {} %}
{% for row in entry.footnotes.all() %}
{% set definitions = definitions|merge({ ('ಠvಠ' ~ row.footnoteId): row.footnoteText }) %}
{% endfor %}
{% do setFootnoteDefinitions(definitions) %}
{{ text|parseFootnoteMarkers }}
{{ getFootnotesHtml() }}
This is very cool!
I'm trying to get the last example working (aggregating footnotes from across supertable rows), but I'm not sure where you're getting the
footnoteId
andfootnoteText
properties.My supertable is set up like this (simplified a bit here):
How do I access footnoteId and footnoteText from that?