# RecentComments Widget

Waline also support recent comments widget to help you display recent comment at the side of your blog.

# Basic

<div id="waline-recent"></div>
<script>
  window.addEventListener('load', function () {
    Waline.Widget.RecentComments({
      el: '#waline-recent',
      serverURL: 'http://waline.vercel.app',
      count: 10,
    });
  });
</script>
1
2
3
4
5
6
7
8
9
10

# Advanced

If you dislike default output HTML format, you can also render by yourself.

<div id="waline-recent"></div>
<script>
  window.addEventListener('load', function () {
    Waline.Widget.RecentComments({
      el: '#waline-recent',
      serverURL: 'http://waline.vercel.app',
      count: 10,
    }).then((comments) => {
      document.getElementById('waline-recent').innerHTML = comments.map(
        (cmt) => `${cmt.nick}: ${cmt.comment}`
      );
    });
  });
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14