comments.txp

Posted

Comments.

<!-- load the comment email into a variable. you will be using this below along with author email variable loaded in form: default.article.txp
     then check the comment email variable against article author email variable, and if it matches add 'comments-author' class -->
<txp:variable name="this_comment" value='<txp:comment_email />' />
<txp:if_variable name="this_comment" value='<txp:author_email />'>
    <article class="comments comments-author" itemscope itemtype="http://schema.org/Comment">
<txp:else />
    <article class="comments" itemscope itemtype="http://schema.org/Comment">
</txp:if_variable>

    <h4>
        <span class="comment-author" itemprop="author" itemscope itemtype="http://schema.org/Person">
            <span itemprop="name">
                <txp:comment_name />
            </span>
        </span>

        <!-- ...now check the comment email variable against article author email variable, and if it matches add '(author)' text -->
        <txp:if_variable name="this_comment" value='<txp:author_email />'>
            <span class="is-author">
                (<txp:text item="author" />)
            </span>
        </txp:if_variable>

        <!-- add a permlink so people can link direct to this comment -->
        <span class="comment-anchor" itemprop="url">
            <txp:comment_permlink>#</txp:comment_permlink>
        </span>

    </h4>

    <!-- also add a 'since' to show comment freshness -->
    <p class="footnote">
        <time datetime="<txp:comment_time format="iso8601" />" itemprop="dateCreated">
            <txp:comment_time />
            (<txp:comment_time format="since" />)
        </time>
    </p>

    <div itemprop="text">
        <txp:comment_message />
    </div>

</article>

Author