Hugo Utterances Module

This module add support for Utterances comments engine, a lightweight comments widget built on GitHub issues.

Module
github.com/hugomods/utterances
GitHub Stars Used By Used By Used By Used By

Features§

  • Flexible and Configurable.
  • JS APIs: change theme on the fly, it’s usually used in the case of color(dark/light) changed.

Installation§

Requires extended Hugo and Go.

Append the github.com/hugomods/utterances to the module.imports.

1[[module.imports]]
2path = "github.com/hugomods/utterances"
toml

Site Parameters§

NameTypeRequiredDefaultDescription
endpointStringYhttps://utteranc.es/The client script endpoint.
repoStringY-The GitHub repository, user/repo.
mappingStringNpathnameThe mapping between blog posts and GitHub issues. Available options: pathname, url, title, og:title.
themeStringNpreferred-color-schemeAvailable options: github-light, github-dark, github-dark-orange, icy-dark, dark-blue, photon-dark, preferred-color-scheme, boxy-light, gruvbox-dark.
labelStringNcommentsThe label that will be assigned to issues created by Utterances.

See the configuration for details.

Usage§

See the example site and it’s source code.

Configuration§

Firstly, we’ll need to tweak the site parameters listed above.

Import Script§

Then place the following partial to your template where you want the comments to appear.

1{{ partial "utterances/script" . }}
go-html-template

Or specify another options than .Site.Params.utterances, it’s used to specify multiple Utterances configurations.

The global options will be merged into the custom options.

1{{ partial "utterances/script-with-options" .Site.Params.blog.utterances }}
go-html-template

JS APIs§

You may want to change the Utterances theme on the fly, a common example is changing the Utterances to the corresponding theme when the user switches colors(dark/light).

1import Utterances from 'mods/utterances/js';
2
3const utterances = new Utterances();
4utterances.setTheme('github-dark');
js

You can find the real example on the example site.

  • All
  • English
  • 简体中文
  • Best match
  • Oldest
  • Newest
  • 2023
  • 2024
  • Hugo Modules Authors
  • OpenModels
  • Razon Yang
  • Bootstrap
  • Comment Engine
  • Content
  • Deployment
  • Docker Images
  • Go
  • HTML
  • Hugo
  • Icons
  • Images
  • Mermaid
  • Module
  • Modules
  • PWA
  • Search
  • SEO
  • Shortcode
  • Shortcodes
  • Toggle
  • 搜索
  • Docker
  • Docs
  • Hugo
  • Module
  • Modules
  • News
  • Shortcode
  • Tutorials
  • 教程
  • 模块
  • Abbr
  • Abbreviations
  • Accordion
  • Alert
  • Alternatives
  • Analytics
  • Animation
  • AOS
  • Articles
  • Asciinema
  • AutoPrefixer
  • BaseURL
  • Bilibili
  • Bootstrap
  • Bootstrap Icons
  • Brightness
  • Button
  • Card
  • Clearfix
  • Code
  • Code Block
  • Code Editor
  • CodePen
  • Col
  • Collapse
  • ColorBalance
  • Colorize
  • Config
  • Container
  • Contrast
  • Crop
  • CSS
  • CSS Variables
  • Debug
  • Deployment
  • Development
  • Diagrams
  • DigitalOcean
  • Digitalocean App Platform
  • Display
  • Docker
  • Docker Hub
  • Docsy
  • EmGitHub
  • Encrypt
  • Environment Variables
  • Favicons
  • Feather Icons
  • Features
  • Fill
  • Fit
  • Flowchart
  • Font Awesome Icons
  • Gamma
  • GaussianBlur
  • Giscus
  • GitHub
  • GitHub Container Registry
  • Google AdSense
  • Google Analytics
  • Grayscale
  • Grid
  • HTML
  • Hue
  • HugoPress
  • I18n
  • Icon Grid
  • Image
  • Internationalization
  • Invert
  • JavaScript
  • JS
  • JSFiddle
  • JSON
  • JSRun
  • KaTeX
  • Lead
  • Link
  • Material Design Icons
  • Math
  • Mergify
  • Microsoft Clarity
  • Modal
  • Music
  • NetEase Cloud Music
  • Offline
  • Open Graph
  • Parameters
  • Pixelate
  • Plausible Analytics
  • PostCSS
  • Proxy
  • Ratio
  • Renovate
  • Requirements
  • Resize
  • Row
  • RTLCSS
  • Saturation
  • Schema
  • Scroll
  • Search
  • Sepia
  • Service Worker
  • Sigmoid
  • Simple Icons
  • Single Page
  • Snackbar
  • Tabler Icons
  • Terminal
  • Toggle
  • TOML
  • Translations
  • Twikoo
  • Twitter Cards
  • UnsharpMask
  • Utterances
  • Video
  • Video.js
  • YAML
  • YouKu
  • CSS 变量
  • i18n
  • 代理服务器
  • 单页
  • 参数
  • 国际化
  • 模态框