Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Comments: from table to div

Started by carlos 7 years ago · 0 replies · 564 views
7 years ago

Hello to all,
I need to add a little bit of css to the comments, at the moment I only have a cell without format. My guess is to change the snippet below from the file comments.html.twig in the folder partials: (But I'm not having success).
It's the that file the one to change?
thanks in advance.
Carlos

TWIG
    {% if grav.twig.comments|length %}

    <h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>

    <table>
        {% for comment in grav.twig.comments|array_reverse %}
        <tr>
            <td>
                {{comment.text}}
                <br />
                {{'PLUGIN_COMMENTS.WRITTEN_ON'|t}} {{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}}
            </td>
        </tr>
        {% endfor %}
    </table>
{% endif %}

Change the code to something like this, So I can add css format.

TWIG
{% if grav.twig.comments|length %}

    <h3>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h3>

        {% for comment in grav.twig.comments|array_reverse %}
        <div>
            <p class="p-comment"> {{comment.text}} </p>
            <br/>
            <br/>
            {{'PLUGIN_COMMENTS.WRITTEN_ON'|t}} {{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} <h4>{{comment.author}}</h4>
        </div>
        {% endfor %}
{% endif %}

Suggested topics

Topic Participants Replies Views Activity
General · by jeremycherfas, 1 week ago
4 181 2 days ago
General · by lynbor, 6 days ago
2 122 3 days ago
General · by Old Man Umby, 1 week ago
1 100 1 week ago
General · by Sebastian, 1 week ago
1 124 1 week ago
General · by Andy Miller, 3 weeks ago
0 248 3 weeks ago