Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-02-15 10:08:02

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 453
Website

Recent Articles Page

By request of a reader, I just created a Recent Comments page.

It is very simple using only tags straight out of the txp box:

Article

<txp:recent_comments form="recent_comments" limit="20" />

Form

<!-- Load the comment email into a variable. Then check it against article author email variable. 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="https://schema.org/Comment">
<txp:else />
    <article class="comments" itemscope itemtype="https://schema.org/Comment">
</txp:if_variable>
<txp:if_different>
    <hr><h2 class="mb-5"><txp:permlink><txp:title /></txp:permlink></h2>
</txp:if_different>
    <h4><span class="comment-author" itemprop="author" itemscope itemtype="https://schema.org/Person"><span itemprop="name"><txp:comment_name link="0"/></span></span><!-- Check the comment email variable against article author email variable. 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></h4>
<div class="comment<txp:if_variable name="this_comment" value='<txp:author_email />'> comment-author</txp:if_variable>" itemprop="text"><txp:comment_message /></div>
<p><small class="text-muted"><span class="comment-anchor" itemprop="url"><txp:comment_permlink>Comment #<txp:comment_id /></txp:comment_permlink></span> · <time datetime="<txp:comment_time format="iso8601" />" itemprop="dateCreated"><txp:comment_time format="%B %e, %Y" /></time></small></p>
</article>

Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

Board footer

Powered by FluxBB