4/30/2024 0 Comments Markdown table of contentsThe number of total headings including children. Number of children (only if has_children is true)Īlso, there are the following global variables present inside the toc tag: Variable Id of parent item if current item is a child The internal id used to assign children and parentsĪ flag to determine if the current heading is at root level The title of the heading (Note: title would be more obvious, but this lead to some weird cascade issues.) If you don't want to display your ToC as a nested list you can pass the parameter is_flat which flattens your list to one level: Įvery Item has the following variables at your disposal: Variable Just pass it along to the tag like this: ![]() You can also use this addon with your markdown-fields. If you prefer to save your bard-content as HTML, you can safely turn on save_html: true in your bard-settings. Of course, you can use as many heading-buttons as you like. So, no special headline-sets are needed, just the plain ol' default Bard-field can be used: title: test Behind the scenes it parses the givenĬontent for headlines and generates an associative nested (or unnested, see options below) array that you can iterate through. Ideally, this addon works out-of-the-box with any bard setup. ![]() This Addon provides the functionality to automatically generate an array of headings from your bard or markdown field you can iterate over in your antlers templates.Īdditionally, it ships with a modifier to automatically generate IDs for anchor-links. No further Vendor-Publishing or config files are needed. Install via composer: composer require goldnead/statamic-toc Just like any Antlers-Tag you can use this addon in your templates with the usual Statamic-Magic Sugar: This addon generates a Table-Of-Contents (ToC) for any Bard- or Markdown-Field in Statamic. Learn more about installing addons → LinksĪutomatic Table Of Contents for Statamic Bard or Markdown fields or other HTML content
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |