logo
0
0
WeChat Login
Huazie<huazie.lgh@gmail.com>
Mod: 添加模板引擎支持描述

Hexo Comments Utterances

NPM version Required Node.js version Required Hexo version License GitHub Repo stars

Easily integrate the Utterances comment system into your Hexo blog, a lightweight comment solution based on GitHub Issues.

中文说明/Chinese Documentation

Features

FeatureDescriptionAdvantages
LightweightBased on GitHub Issues, no database requiredZero maintenance cost, high availability
Secure & ReliableFully open source, no ads or trackingProtects user privacy, transparent and trustworthy
Theme SwitchingSupports light/dark theme auto-switchingPerfectly adapts to various theme styles
Responsive DesignAdapts to various device screensMobile-friendly user experience
Instant LoadingSupports lazy loading and loading animationsOptimizes page performance
Easy ConfigurationSimple YAML configurationQuick setup, flexible customization

Quick Start

Installation

# 1. Install multi-comment system core plugin (required) npm install hexo-generator-comments --save # 2. Install Utterances comment plugin npm install hexo-comments-utterances --save

Note: hexo-comments-utterances needs to be used with hexo-generator-comments More info: hexo-generator-comments

Configuration Guide

Basic Configuration

Add the following content to your Hexo site configuration _config.yml or theme configuration _config.yml, _config.[theme].yml:

utterances: # Enable Utterances comment system enable: false # Enable loading prompt, optional values: `true` | `false` loading: true # GitHub repository owner and name, format: username/repo-name repo: your-username/your-repo-name # Specify issue mapping rule issue_term: pathname # Light theme theme: github-light # Dark theme dark: github-dark

Important: Replace your-username/your-repo-name with your actual GitHub repository address

Configuration Options Details

OptionTypeDefaultRequiredDescription
enableBooleanfalseYesEnable Utterances comment system
loadingBooleantrueYesShow comment loading animation
repoString-YesGitHub repository, format: username/repo-name
issue_termStringpathnameYesHow to map comments to issues
themeStringgithub-lightYesLight mode theme
darkStringgithub-darkYesDark mode theme

Advanced Configuration Options

issue_term Mapping Methods

ValueDescriptionUse Cases
pathnameUse page path as issue titleRecommended, suitable for most scenarios
urlUse full page URL as issue titleWhen domain information is needed
titleUse page title as issue titleWhen you want more friendly issue titles
og:titleUse page Open Graph titleSEO optimization scenarios
[issue-number]Specify specific issue numberManual comment management
[specific-term]Use specific term as titleCustom identifiers

Theme Style Options

Theme NameCharacteristics
github-lightGitHub official light theme
boxy-lightBoxy style light theme
github-darkGitHub official dark theme
github-dark-orangeGitHub dark orange theme
icy-darkIcy blue dark theme
dark-blueDark blue theme
photon-darkPhoton dark theme
preferred-color-schemeAuto-follow system theme

Supported Template Engines

This plugin supports all Hexo themes using the following template engines:

Template EngineFile ExtensionSupport Status
EJS.ejs✅ Fully Supported
Nunjucks.njk✅ Fully Supported
JSX + Inferno.jsx✅ Fully Supported

Prerequisites

Before getting started, please ensure the following requirements are met:

1. GitHub Repository Preparation

  • Have a public GitHub repository
  • Issues feature is enabled for the repository

2. Install Utterances App

  • Visit Utterances GitHub App
  • Click "Install" and select your repository
  • Authorize Utterances to access your repository

Note: Utterances App only requires read-write permissions for Issues, very secure

How It Works

Detailed Process

  1. Page Loading: Visitor opens the page, Utterances script starts working
  2. Search Issue: Search for related issues in the specified repository based on configured issue_term
  3. Display Comments: If corresponding issue is found, display comments from it
  4. Create Issue: When commenting for the first time, automatically create a new issue
  5. GitHub Login: Visitors need a GitHub account to participate in comments

Related Links

Official Resources

Hexo Documentation

Related Plugins

License

This project is open source under the MIT license.