Integrating Waline Comment System into Your Blog

Using Waline as a commenting solution with Vercel + LeanCloud

Zoran · 4 min read · 644 words

Waline Comment System

Waline is a serverless commenting system backed by LeanCloud and other backends, extremely popular for Hugo and other static site generators.

Why Waline?

FeatureWalineDisqusGiscus
Self-hosted✅ (GitHub)
No ads❌ (Pro only)
Data ownership
Login optionsMultipleMultipleGitHub only
Markdown support
Email notifications
Free✅ (with ads)

Architecture

[Visitor] → [Vercel (Waline server)] → [LeanCloud (Database)]
                                              ↓
                                     [Email Notification]

Step 1: Set Up LeanCloud

Create an Account

  1. Go to leancloud.app (International) or leancloud.cn (China)
  2. Create a new application
  3. Go to SettingsApp Keys
  4. Note down: AppID, AppKey, MasterKey

Create the Comment Table

In LeanCloud dashboard:

  1. Go to StorageCreate Class
  2. Name it Comment
  3. Add columns: nick, mail, link, comment, ua, url, ip, insertedAt

Step 2: Deploy Waline to Vercel

One-Click Deploy

Click the deploy button on the Waline documentation or:

  1. Fork/clone github.com/walinejs/waline
  2. Import to Vercel
  3. Set environment variables:
VariableValue
LEAN_IDYour LeanCloud AppID
LEAN_KEYYour LeanCloud AppKey
LEAN_MASTER_KEYYour LeanCloud MasterKey
SITE_NAMEYour blog name
SITE_URLYour blog URL
SMTP_SERVICE(Optional) For email notifications
AUTHOR_EMAIL(Optional) Your email
  1. Deploy!

After deployment, you’ll get a URL like https://waline-xxxxx.vercel.app.


Step 3: Integrate with Your Blog

Hugo (PaperMod Theme)

Add to config.toml:

[params]
  [params.waline]
    serverURL = "https://waline-xxxxx.vercel.app"
    lang = "en"
    visitor = true
    emoji = [
      "https://unpkg.com/@waline/[email protected]/weibo",
      "https://unpkg.com/@waline/[email protected]/bilibili"
    ]

Astro

Install the Waline client:

npm install @waline/client

Add to your post layout:

---
import { init } from '@waline/client';
---

<div id="waline"></div>

<script>
  init({
    el: '#waline',
    serverURL: 'https://waline-xxxxx.vercel.app',
    lang: 'en',
    dark: 'auto',
    emoji: [
      'https://unpkg.com/@waline/[email protected]/weibo',
    ],
  });
</script>

Generic HTML

Add to any page:

<div id="waline"></div>
<link rel="stylesheet" href="https://unpkg.com/@waline/client@v3/dist/waline.css" />
<script type="module">
  import { init } from 'https://unpkg.com/@waline/client@v3/dist/waline.js';
  init({
    el: '#waline',
    serverURL: 'https://waline-xxxxx.vercel.app',
  });
</script>

Step 4: Configure Waline

Admin Management

Visit https://waline-xxxxx.vercel.app/ui to manage comments:

  • Approve/delete comments
  • Pin important comments
  • View visitor statistics
  • Configure spam filtering

Akismet Spam Protection

Add to Vercel environment variables:

AKISMET_KEY=your_akismet_api_key

Email Notifications

Configure SMTP in Vercel environment:

SMTP_SERVICE=QQ         # or Gmail, 163, etc.
[email protected]
SMTP_PASS=your_password
SITE_NAME=My Blog

Migration from Other Systems

From Disqus

Waline provides an import tool at https://waline-xxxxx.vercel.app/ui/migration.

From Giscus/GitHub Issues

Export GitHub issues as JSON, then use the Waline import API.


Troubleshooting

IssueSolution
Comments not loadingCheck browser console for CORS errors; verify Vercel URL
401 UnauthorizedCheck LeanCloud keys in Vercel env vars
500 Server ErrorCheck Vercel function logs
Chinese characters garbledSet lang: 'zh-CN' in Waline config
IP not recordedEnable recordIP: true in server config

Conclusion

Waline provides a complete, self-hosted commenting solution:

Free — Vercel free tier + LeanCloud free tier
Data ownership — You own all comment data
No ads — Unlike Disqus free plan
Customizable — Full control over UI and features
Multi-platform — Works with any static site generator

It’s the ideal commenting solution for personal blogs and documentation sites.