Comments Starters Sprig
Reading as a guest. Sign in as

Short thread

Every starter shows this post's comments, drawn by the same renderer the plugin uses on Craft's own pages.

Sign in as Priya to comment as a member, or as Sam to see the moderator's view, with the comment that's waiting for approval and the one that's been reported. As a guest you can still comment, vote and report.

The comment form asks for a rating, which is shown on the comment, an order number that only the team sees, and a photo. Members are also asked where they're reading from.

9 comments

Code for Sprig

craft/templates/sprig/index.twig View on GitHub
{#
 # Sprig re-renders a component on the server and swaps it into the page with htmx. Comments' script
 # notices the new mount point and starts its thread, and stops the thread that was swapped out.
 #}
{% extends '_starter' %}
{% set pageTitle = 'Sprig' %}
{% set starter = { name: 'Sprig', logo: 'sprig', files: ['sprig/index.twig', 'sprig/_component.twig'] } %}

{% block demo %}
    {{ sprig('sprig/_component', { slug: 'welcome-to-the-comments-starters' }) }}
{% endblock %}

{% block about %}
    Choose a post and Sprig swaps it in, thread and all. <strong>Reload this post</strong> re-renders the component without changing post, and the thread keeps what’s typed in it because it’s marked <code>s-preserve</code>.
{% endblock %}