Waline Config

Mr.Hope ... 2021-5-16 About 2 min

# el

  • Type: string | HTMLElement
  • Default: '#waline'

The DOM element to be mounted on initialization. It must be a valid CSS selector string or HTMLElement Object.

Tips

If you only want to use the pageview statistics feature, DO NOT set it.

# serverURL

  • Type: string
  • Required: Yes

Waline server address url

# path

  • Type: string
  • Default: window.location.pathname
  • Required: No

Article path id. Used to distinguish different article pages to ensure loading the correct comment list under the article page.

Optional value:

  • window.location.pathname (default, recommended)
  • window.location.href
  • customize

I. Please ensure the uniqueness of each article page path, otherwise the same comment list may be loaded under different article pages.

II. If the value is window.location.href, it may appear that adding different parameters to enter the page, and it will be judged as a new page.

# lang

  • Type: string
  • Default: 'zh-CN'
  • Required: No

Display language.

Optional value:

  • 'zh'
  • 'zh-CN'
  • 'zh-TW'
  • 'en'
  • 'en-US'
  • 'jp'
  • 'jp-JP'

If you need a custom language, please refer to i18n.

# visitor

  • Type: boolean
  • Default: false
  • Required: No

Article reading statistics.

# emoji

  • Type: (string | EmojiInfo)[]
  • Default: ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']

Emoji settings, for details see Custom Emoji

# dark

  • Type: string
  • Required: No

Darkmode support

  • Set it to 'auto' will display darkmode due to device settings.
  • Filling in a CSS selector will enable darkmode only when the selector match waline ancestor nodes.

Examples

  • Docusaurus: It will enable darkmode by setting data-theme="dark" on the <html> tag itself. So you need to set 'html[data-theme="dark"]' as dark option.

  • hexo-theme-fluid: It will enable darkmode by setting data-user-color-scheme="dark" on the <html> tag itself. So you need to set 'html[data-user-color-scheme="dark"]' as dark option.

  • vuepress-theme-hope: It will enable darkmode by setting theme-dark class on the <body> tag itself. So you need to set 'body.theme-dark' as dark option.

For details of custom style and darkmode, please see Custom Style.

# meta

  • Type: string[]
  • Default: ['nick','mail','link']
  • Required: No

Reviewer attributes. Optional values: 'nick', 'mail', 'link'

# requiredMeta

  • Type: string[]
  • Default: []
  • Required: No

Set required fields, default anonymous, optional values:

  • []
  • ['nick']
  • ['nick','mail']

# login

  • Type: string
  • Default value: 'enable'
  • Required: No

Login mode status, optional values:

  • 'enable': enable login (default)
  • 'disable': Login is disabled, users should fill in information to comment
  • 'force': Forced login, users must login to comment

# avatar

  • Type: string
  • Default: 'mp'
  • Required: No

Gravatar (opens new window) type.

Optional value:

  • '' (Empty string)
  • 'mp'
  • 'identicon'
  • 'monsterid'
  • 'wavatar'
  • 'retro'
  • 'robohash'
  • 'hide'

See the Avatar setting for more details.

# wordLimit

  • Type: number | [number, number]
  • Default: 0
  • Required: false

Comment word s limit. When a single number is filled in, it 's the maximum number of comment words. No limit when set to 0.

# pageSize

  • Type: number
  • Default: 10
  • Required: No

number of comments per page.

# avatarCDN

  • Type: string
  • Default: https://sdn.geekzu.org/avatar/
  • Required: No

Gravatar CDN baseURL.

# avatarForce

  • Type: boolean
  • Default: false
  • Required: No

Whether force pulling the latest avatar each time.

# uploadImage

  • Type: Function
  • Required: No

Custom image upload callback to manage picture by yourself. We will pass a picture file object when execute it.

# highlight

  • Type: boolean
  • Default: true
  • Required: No

Code highlighting, it’s enabled by default, please close it selectively.

  • Type: boolean
  • Default: true
  • Required: No

Whether show copyright and version in footer.

Tips

We hope you can keep it on to support Waline.

# Deprecated API

The following APIs are still valid, but they will be removed in V2.

# langMode

Obsolete

Please use locale instead.

  • Type: Locale
  • Required: No

Custom I18N.

# placeholder

Obsolete

Please use locale.placeholder instead.

  • Type: string
  • Default: Just go go...
  • Required: No

Comment box placeholder

# emojiCDN

Obsolete

Please use emoji instead.

  • Type: string
  • Default: https://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/
  • Required: No

Set Emoji Pack CDN, refer to Custom Emoji

# emojiMaps

Obsolete

Please use emoji instead.

  • Type: Object
  • Default: null
  • Required: No

Set `Emoji Packet Mapping’, refer to Custom Emoji

# requiredFields

Obsolete

Please use requiredMeta instead.

# anonymous

Obsolete

Please use login instead.

  • Type: boolean
  • Required: No

Whether to allow login comments. Both supported by default, set to true means only support anonymous comments, false means only support login comments.

Deprecated

Please use copyright instead.