Comments Starters Datastar
Reading as a guest. Sign in as

Short thread

Patched from the server at 20:18:08

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 Datastar

craft/templates/datastar/index.twig View on GitHub
{#
 # Datastar asks the server for HTML over server-sent events and morphs it into the page. Choosing a post
 # patches the whole post, thread included, while refreshing the same post morphs around the thread.
 #}
{% extends '_starter' %}
{% set pageTitle = 'Datastar' %}
{% set starter = { name: 'Datastar', logo: 'datastar', files: ['datastar/index.twig', 'datastar/_post.twig', 'datastar/_patch.twig'] } %}

{% set posts = craft.entries.section('blog').orderBy('postDate desc').all() %}
{% set entry = craft.entries.section('blog').slug('welcome-to-the-comments-starters').one() %}

{% block demo %}
    {% include 'datastar/_post' %}

    {% do view.registerAssetBundle('putyourlightson\\datastar\\assets\\DatastarAssetBundle') %}
{% endblock %}

{% block about %}
    Choose a post and Datastar morphs it in from the server. <strong>Refresh from the server</strong> patches the same post again, and the thread stays as it is because it’s marked <code>data-ignore-morph</code>.
{% endblock %}