Skip to main content

Comment Service

About 3 minFeatureCommentFeature

vuepress-theme-hope implements the comment feature with built-in @vuepress/plugin-commentopen in new window.

Info

vuepress-theme-hope passes plugins.comment in theme options as plugin options to @vuepress/plugin-comment.

Enable Support page config

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    plugins: {
      comment: {
        // choose a comment provider
        provider: "Waline",

        // provider options
        serverURL: "...", // your serverURL
      },
    },
  }),
};







 


 




Comment feature is enabled globally by default, controlled by plugins.comment.comment options.

Tips

For the complete config item of the plugin, please see plugin documentationopen in new window.

Comment Provider

Currently, you can choose from Giscus, Waline, Twikoo and Artalk.

Comment service selection

  • Giscus is recommended if your blog or documentation is primarily geared towards programmers.
  • If your blog or documentation is for the general public, Waline is recommended.

Giscus

Giscus is a GitHub Discussion based commenting system that is easy to start.

Preparation

  1. You need to create a public repository and open discussion as a place to store comments
  2. You need to install the Giscus Appopen in new window to have permission to access the corresponding repository.

After completing the above steps, please go to the Giscus pageopen in new window to get your settings. You just need to fill in the repository and Discussion categories, then scroll to the "Enable giscus" section at the bottom of the page and copy the data-repo, data-repo-id, data-category and data-category-id four items as they are required.

Config

Please pass data-repo, data-repo-id, data-category and data-category-id as plugin options as repo, repoId, category categoryId.

For other options, see Giscus Configopen in new window.

Waline

pnpm
pnpm add -D @waline/client

Get APP_ID and APP_Key

Sign inopen in new window or sign upopen in new window leancloud. Then create new application in Leancloud, and you will get APP ID / APP Key / APP Master Key.

After that, create a vercel app using the below button.

Vercelopen in new window
Vercel

Then input your new GitHub repo name and set LEAN_ID, LEAN_KEY and LEAN_MASTER_KEY environment variables in the "Environment Variables" column. APP ID is the value of LEAN_ID, and APP Key to LEAN_KEY, Master Key to LEAN_MASTER_KEY.

Click Deploy button to deploy. It will show you deploy successfully after some time. Then config the vercel link in your theme options:

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    plugins: {
      comment: {
        provider: "Waline",
        serverURL: "YOUR_SERVER_URL", // your server url
      },
    },
  }),
};






 
 




Tips

Config will be listed on Waline Configopen in new window.

For more details, please see Waline Docsopen in new window

Twikoo

pnpm
pnpm add -D twikoo

Vercel Deployment

  1. Apply for MongoDBopen in new window account

  2. Create a free MongoDB database, the recommended region is AWS / N. Virginia (us-east-1)

  3. Click CONNECT on the Clusters page, follow the steps to allow connections from all IP addresses (Why?open in new window), create Database user, and record the database connection string, please change the <password> in the connection string to the database password

  4. Sign up for a Vercelopen in new window account

  5. Click the button below to deploy Twikoo to Vercel in one click

    Vercelopen in new window
    Vercel
  6. Go to Settings - Environment Variables, add the environment variable MONGODB_URI, the value is the database connection string in step 3

  7. Go to Overview, click the link under Domains, if the environment configuration is correct, you can see the prompt "Twikoo cloud function is running normally"

  8. Vercel Domains (with https:// prefix, for example https://xxx.vercel.app) is your environment ID

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    plugins: {
      comment: {
        provider: "Twikoo",
        envId: "YOUR_SERVER_URL", // your server url
      },
    },
  }),
};






 
 




Note

Click the "little gear" icon in the comment window to set the administrator password

Artalk

pnpm
pnpm add -D artalk

Deploy Artalk Server

See the Artalk documentationopen in new window for deploying artalk server.

Artalk Configuration

Please set provider: "Artalk" and pass your server link to server in the plugin options.

For other configuration items, see Artalk Configurationopen in new window.

Note

The plugin retains the el option and inserts Artalk itself on the page. At the same time, the plugin will automatically set the pageTitle, pageKey and site options for you according to the VuePress information.

Before VuePress2 provides client configuration, the two function options imgUploader and avatarURLBuilder are not supported.