yufan.me/src/components/sidebar/RecentComments.astro

31 lines
864 B
Plaintext

---
import { latestComments } from '@/helpers/db/query';
import options from '@/options';
---
{
options.settings.sidebar.comment > 0 && (
<div id="recent-comments" class="widget widget-recent-comments">
<div class="widget-title">近期评论</div>
<ul id="recent-comments">
{(await latestComments()).map((comment) => (
<li class="recent-comments">
<span class="comment-author-link">
{comment.authorLink === '' ? (
comment.author
) : (
<a href={comment.authorLink} target="_blank" rel="nofollow">
{comment.author}
</a>
)}
</span>
{'发表在《'}
<a href={comment.permalink}>{comment.title}</a>
{'》'}
</li>
))}
</ul>
</div>
)
}