コメント
記事コメントウィジェットを設定します。Tralume は remark42、giscus、utterances、waline、twikoo をサポートし、プロバイダーが対応している場合はウィジェットを現在のサイトテーマとページ言語に追従させます。デフォルトでは、コメントスレッドは言語別 URL で分割されるのではなく、デフォルト言語の正式な URL を使用します。
サポートされるプロバイダー
| プロバイダー | バックエンド | 必須キー |
|---|---|---|
remark42 | セルフホスト Remark42 | host |
giscus | GitHub Discussions | repo, repoId, category, categoryId |
utterances | GitHub Issues | repo |
waline | Waline サーバー | serverURL |
twikoo | Twikoo 環境 | envId |
基本設定
hugo.toml で1つのプロバイダーを設定します:
[params.comments]
provider = 'remark42'
# Note: Strategy used to merge comment threads.
# Note: defaultLanguage uses the formal URL of the default language; this is the theme default.
mergeStrategy = 'defaultLanguage'
[params.comments.providers.remark42]
# Note: Remark42 service URL. It must match REMARK_URL in the backend configuration.
host = 'https://remark42.example.com'
# Note: Site ID. It must match SITE in the Remark42 backend startup settings.
siteId = 'my-site'選択されたプロバイダーのみがレンダリングされます。そのプロバイダーに必須キーが不足している場合、コメントカードはレンダリングされません。
Giscus
[params.comments]
provider = 'giscus'
# Note: defaultLanguage shares one discussion across translated pages.
mergeStrategy = 'defaultLanguage'
[params.comments.providers.giscus]
# Note: GitHub repository that has Giscus installed.
repo = 'owner/repo'
# Note: Repository ID from the Giscus configuration page.
repoId = 'R_kgDOExample'
# Note: GitHub Discussions category name.
category = 'Announcements'
# Note: Category ID from the Giscus configuration page.
categoryId = 'DIC_kwDOExample'オプションの Giscus パラメータ:
[params.comments.providers.giscus]
# Note: Mapping mode. The theme default is specific, using the shared thread URL as term.
mapping = 'specific'
# Note: Custom term. Leave unset to use the URL generated by mergeStrategy.
term = 'custom-thread-id'
# Note: Enable strict title matching.
strict = false
# Note: Show reaction controls.
reactionsEnabled = true
# Note: Emit discussion metadata events.
emitMetadata = false
# Note: Comment input position.
inputPosition = 'bottom'
# Note: Giscus themes used for Tralume light/dark mode.
lightTheme = 'light'
darkTheme = 'dark'Utterances
[params.comments]
provider = 'utterances'
mergeStrategy = 'defaultLanguage'
[params.comments.providers.utterances]
# Note: GitHub repository that has Utterances installed.
repo = 'owner/repo'オプションの Utterances パラメータ:
[params.comments.providers.utterances]
# Note: Custom issue term. Leave unset to use the URL generated by mergeStrategy.
issueTerm = 'custom-thread-id'
# Note: Label applied to issues created by Utterances.
label = 'comments'
# Note: Utterances themes used for Tralume light/dark mode.
lightTheme = 'github-light'
darkTheme = 'github-dark'Waline
[params.comments]
provider = 'waline'
mergeStrategy = 'defaultLanguage'
[params.comments.providers.waline]
# Note: Waline server URL.
serverURL = 'https://waline.example.com'オプションの Waline パラメータ:
[params.comments.providers.waline]
# Note: Custom language code. Leave unset to follow the current page language.
lang = 'en-US'
# Note: Required metadata fields before posting a comment.
requiredMeta = ['nick', 'mail']
# Note: Enable reaction, pageview, and comment counters if your Waline server supports them.
reaction = true
pageview = true
comment = trueTwikoo
[params.comments]
provider = 'twikoo'
mergeStrategy = 'defaultLanguage'
[params.comments.providers.twikoo]
# Note: Twikoo environment ID or server URL, depending on your deployment target.
envId = 'https://twikoo.example.com'オプションの Twikoo パラメータ:
[params.comments.providers.twikoo]
# Note: Tencent Cloud region, only needed for Tencent CloudBase deployment.
region = 'ap-shanghai'
# Note: Custom language code. Leave unset to follow the current page language.
lang = 'en'Remark42 オプションパラメータ
[params.comments.providers.remark42]
# Note: Maximum number of comments shown by default on mobile.
maxShownComments = 20
# Note: Whether to show the email subscription entry to visitors.
showEmailSubscription = true
# Note: Whether to show the RSS subscription entry to visitors.
showRssSubscription = true
# Note: Whether to enable a simpler interface.
simpleView = false
# Note: Whether to hide the Remark42 footer. Hidden by default (true); set to false to show it again.
noFooter = true注意事項
- コメントウィジェットは記事のメタデータカードの後に専用カードとして表示されます。
- Remark42、Giscus、Utterances、Waline は現在のサイトのライト/ダークモードに自動的に追従します。Twikoo は独自のフロントエンドテーマ動作を使用します。
- プロバイダーの言語は、サポートされている場合、現在のページ言語に追従します。テーマは
zh-Hansをzh-CNにマッピングします。英語はenにマッピングされますが、Waline はen-USを使用します。 mergeStrategy = 'smartPath':/zh-hans/posts/test/と/en-us/posts/test/を1つのニュートラルなスレッドに統合します。defaultContentLanguageInSubdir = trueの場合、スレッド URL は/posts/test/のままです。defaultContentLanguageInSubdir = falseでparams.i18nRouting.enableAutoEntry = trueの場合、/auto/posts/test/になり、通知メールも最初にスマートエントリーページに誘導されます。mergeStrategy = 'defaultLanguage': 常にデフォルト言語の正式な URL を共有スレッド識別子として使用します。これがテーマのデフォルトです。デフォルト言語を最も低いweightに保ち、Hugo の言語順序が整合するようにしてください。mergeStrategy = 'none': 各言語 URL ごとに独立したスレッドを保持します。- Giscus はデフォルトで
mapping = 'specific'、Utterances はカスタムイシュー用語をデフォルトとし、Waline/Twikoo はpathを使用します。これら3つはすべて、プロバイダー固有の用語/パス設定を上書きしない限り、mergeStrategyによって生成された URL を使用します。
最終更新日 • alexma233