Sayfa.Blocks.TOC (Sayfa v0.5.0)

Copy Markdown View Source

Table of contents block.

Renders a navigation list of headings for sidebar or mobile use. Supports two variants: :sidebar (default) for desktop border-l nav, and :mobile for a collapsible <details> element.

Assigns

  • :content — current Sayfa.Content struct with meta["toc"]
  • :variant:sidebar (default) or :mobile

Examples

<%= @block.(:toc) %>
<%= @block.(:toc, variant: :mobile) %>