Sayfa.Blocks.RelatedContent (Sayfa v0.5.0)

Copy Markdown View Source

Related content block.

Finds content items sharing the most tags/categories with the current item and renders up to 3 related items with title, date, and first category.

This block auto-detects the current content's type or accepts an explicit type: assign.

Assigns

  • :content — current Sayfa.Content struct
  • :contents — list of all site contents (injected by block helper)
  • :type — content type to search (e.g. "notes", "articles"); defaults to current content's type
  • :limit — number of related items to show (default: 3)

Examples

<%= @block.(:related_content) %>
<%= @block.(:related_content, type: "notes", limit: 5) %>