feat(comment): add Telegram Comments support (#180)

This commit is contained in:
Dillon
2020-03-17 22:39:25 +08:00
committed by GitHub
parent 6b03c711ac
commit 01d814ef6f
13 changed files with 274 additions and 203 deletions

View File

@@ -31,16 +31,17 @@ Compared to the original LeaveIt theme and the KeepIt theme, the LoveIt theme ha
* More readable **dark mode** * More readable **dark mode**
* Some beautiful **CSS animations** * Some beautiful **CSS animations**
* Easy-to-use and self-expanding **table of contents** * Easy-to-use and self-expanding **table of contents**
* More **social links**, **share sites** and **comment system**
* Extended markdown syntax for **[Font Awesome](https://fontawesome.com/) icons** * Extended markdown syntax for **[Font Awesome](https://fontawesome.com/) icons**
* Extended markdown syntax for **ruby annotation** * Extended markdown syntax for **ruby annotation**
* **Mathematical formula** support by [KaTeX](https://katex.org/) * **Mathematical formula** supported by [KaTeX](https://katex.org/)
* **Diagram syntax** shortcode support by [mermaid](https://github.com/knsv/mermaid) * **Diagram syntax** shortcode supported by [mermaid](https://github.com/knsv/mermaid)
* **Interactive data visualization** shortcode supported by [ECharts](https://echarts.apache.org/) * **Interactive data visualization** shortcode supported by [ECharts](https://echarts.apache.org/)
* Embedded **music player** support by [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS) * Embedded **music player** supported by [APlayer](https://github.com/MoePlayer/APlayer) and [MetingJS](https://github.com/metowolf/MetingJS)
* **Bilibili** player support * **Bilibili** player supported
* Kinds of **admonitions** shortcode support * Kinds of **admonitions** shortcode supported
* Custom style shortcodes support * Custom style shortcodes supported
* **CDN** for all third-party libraries support * **CDN** for all third-party libraries supported
* ... * ...
In short, In short,
@@ -57,9 +58,9 @@ I hope you will LoveIt ❤️!
* Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights) * Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
* Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD * Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
* [**Google Analytics**](https://analytics.google.com/analytics) support * [**Google Analytics**](https://analytics.google.com/analytics) supported
* Search engine **verification** support (Google, Bind, Yandex and Baidu) * Search engine **verification** supported (Google, Bind, Yandex and Baidu)
* **CDN** for third-party libraries support * **CDN** for third-party libraries supported
* Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes) * Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
### Appearance and Layout ### Appearance and Layout
@@ -67,21 +68,22 @@ I hope you will LoveIt ❤️!
* **Responsive** layout * **Responsive** layout
* **Dark/Light** mode * **Dark/Light** mode
* Globally consistent **design language** * Globally consistent **design language**
* **Pagination** support * **Pagination** supported
* Easy-to-use and self-expanding **table of contents** * Easy-to-use and self-expanding **table of contents**
* **Multilanguage** support and i18n ready * **Multilanguage** supported and i18n ready
* Beautiful **CSS animation** * Beautiful **CSS animation**
### Social and Comment Systems ### Social and Comment Systems
* **Gravatar** supported by [Gravatar](https://gravatar.com) * **Gravatar** supported by [Gravatar](https://gravatar.com)
* Local **Avatar** support * Local **Avatar** supported
* Up to **61** social sites supported * Up to **61** social links supported
* Up to **28** share sites support * Up to **28** share sites supported
* **Disqus** comment system supported by [Disqus](https://disqus.com) * **Disqus** comment system supported by [Disqus](https://disqus.com)
* **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) * **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk)
* **Valine** comment system supported by [Valine](https://valine.js.org/) * **Valine** comment system supported by [Valine](https://valine.js.org/)
* **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* **Telegram Comments** system supported by [Comments](https://comments.app/)
### Extended Features ### Extended Features

View File

@@ -30,6 +30,7 @@
* 可读性更强的**暗黑模式** * 可读性更强的**暗黑模式**
* 一些美观的 **CSS 动画** * 一些美观的 **CSS 动画**
* 易用和自动展开的**文章目录** * 易用和自动展开的**文章目录**
* 支持更多的**社交链接**、**网站分享**和**评论系统**
* 支持基于 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法 * 支持基于 **[Font Awesome](https://fontawesome.com/) 图标**的扩展 Markdown 语法
* 支持**上标注释**的扩展 Markdown 语法 * 支持**上标注释**的扩展 Markdown 语法
* 支持基于 [KaTeX](https://katex.org/) 的**数学公式** * 支持基于 [KaTeX](https://katex.org/) 的**数学公式**
@@ -77,6 +78,7 @@
* 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 * 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统
* 支持 **[Valine](https://valine.js.org/)** 评论系统 * 支持 **[Valine](https://valine.js.org/)** 评论系统
* 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统 * 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
* 支持 **[Telegram Comments](https://comments.app/) 评论**系统
### 扩展功能 ### 扩展功能

View File

@@ -301,11 +301,6 @@
.version { .version {
font-weight: bold; font-weight: bold;
font-style: normal; font-style: normal;
color: $global-highlight-color;
.dark-theme & {
color: $global-highlight-color-dark;
}
} }
} }

View File

@@ -32,10 +32,6 @@ $global-link-hover-color-dark: #fff !default;
// Color of the border // Color of the border
$global-border-color: #dcdcdc !default; $global-border-color: #dcdcdc !default;
$global-border-color-dark: #4a4b50 !default; $global-border-color-dark: #4a4b50 !default;
// Color of the highlight
$global-highlight-color: #df1a08 !default;
$global-highlight-color-dark: #fff !default;
// ========== Global ========== // // ========== Global ========== //
// ========== Scrollbar ========== // // ========== Scrollbar ========== //

View File

@@ -249,6 +249,16 @@ enableEmoji = true
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "en_US" languageCode = "en_US"
# Telegram Comments Config (https://comments.app/)
[languages.en.params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
[languages.zh-cn] [languages.zh-cn]
weight = 2 weight = 2
@@ -473,6 +483,16 @@ enableEmoji = true
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "zh_CN" languageCode = "zh_CN"
# Telegram Comments 评论系统设置 (https://comments.app/)
[languages.zh-cn.params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
[languages.fr] [languages.fr]
weight = 3 weight = 3
@@ -697,6 +717,16 @@ enableEmoji = true
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "fr" languageCode = "fr"
# Telegram Comments Config (https://comments.app/)
[languages.fr.params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
[params] [params]
# LoveIt theme version # LoveIt theme version

View File

@@ -25,9 +25,9 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
* :(fas fa-rocket): Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights) * :(fas fa-rocket): Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
* :(fab fa-searchengin): Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD * :(fab fa-searchengin): Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
* :(fab fa-google): [**Google Analytics**](https://analytics.google.com/analytics) support * :(fab fa-google): [**Google Analytics**](https://analytics.google.com/analytics) supported
* :(fas fa-search): Search engine **verification** support (Google, Bind, Yandex and Baidu) * :(fas fa-search): Search engine **verification** supported (Google, Bind, Yandex and Baidu)
* :(fas fa-tachometer-alt): **CDN** for third-party libraries support * :(fas fa-tachometer-alt): **CDN** for third-party libraries supported
* :(fas fa-cloud-download-alt): Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes) * :(fas fa-cloud-download-alt): Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
#### Appearance and Layout #### Appearance and Layout
@@ -35,21 +35,22 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
* :(fas fa-desktop): / :(fas fa-mobile): **Responsive** layout * :(fas fa-desktop): / :(fas fa-mobile): **Responsive** layout
* :(fas fa-moon): / :(fas fa-sun): **Dark/Light** mode * :(fas fa-moon): / :(fas fa-sun): **Dark/Light** mode
* :(fas fa-layer-group): Globally consistent **design language** * :(fas fa-layer-group): Globally consistent **design language**
* :(fas fa-ellipsis-h): **Pagination** support * :(fas fa-ellipsis-h): **Pagination** supported
* :(far fa-list-alt): Easy-to-use and self-expanding **table of contents** * :(far fa-list-alt): Easy-to-use and self-expanding **table of contents**
* :(fas fa-language): **Multilanguage** support and i18n ready * :(fas fa-language): **Multilanguage** supported and i18n ready
* :(fab fa-css3-alt): Beautiful **CSS animation** * :(fab fa-css3-alt): Beautiful **CSS animation**
#### Social and Comment Systems #### Social and Comment Systems
* :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com) * :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com)
* :(fas fa-user-circle): Local **Avatar** support * :(fas fa-user-circle): Local **Avatar** supported
* :(far fa-id-card): Up to **61** social sites supported * :(far fa-id-card): Up to **61** social links supported
* :(fas fa-share-square): Up to **28** share sites support * :(fas fa-share-square): Up to **28** share sites supported
* :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com) * :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com)
* :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) * :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk)
* :(far fa-comment-alt): **Valine** comment system supported by [Valine](https://valine.js.org/) * :(far fa-comment-alt): **Valine** comment system supported by [Valine](https://valine.js.org/)
* :(far fa-comments): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * :(far fa-comments): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* :(fas fa-comments): **Telegram Comments** system supported by [Comments](https://comments.app/)
#### Extended Features #### Extended Features

View File

@@ -30,9 +30,9 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
* :(fas fa-rocket): Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights) * :(fas fa-rocket): Optimized for **performance**: 99/100 on mobile and 100/100 on desktop in [Google PageSpeed Insights](https://developers.google.com/speed/pagespeed/insights)
* :(fab fa-searchengin): Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD * :(fab fa-searchengin): Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD
* :(fab fa-google): [**Google Analytics**](https://analytics.google.com/analytics) support * :(fab fa-google): [**Google Analytics**](https://analytics.google.com/analytics) supported
* :(fas fa-search): Search engine **verification** support (Google, Bind, Yandex and Baidu) * :(fas fa-search): Search engine **verification** supported (Google, Bind, Yandex and Baidu)
* :(fas fa-tachometer-alt): **CDN** for third-party libraries support * :(fas fa-tachometer-alt): **CDN** for third-party libraries supported
* :(fas fa-cloud-download-alt): Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes) * :(fas fa-cloud-download-alt): Automatically converted images with **Lazy Load** by [lazysizes](https://github.com/aFarkas/lazysizes)
#### Appearance and Layout #### Appearance and Layout
@@ -40,21 +40,22 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a
* :(fas fa-desktop): / :(fas fa-mobile): **Responsive** layout * :(fas fa-desktop): / :(fas fa-mobile): **Responsive** layout
* :(fas fa-moon): / :(fas fa-sun): **Dark/Light** mode * :(fas fa-moon): / :(fas fa-sun): **Dark/Light** mode
* :(fas fa-layer-group): Globally consistent **design language** * :(fas fa-layer-group): Globally consistent **design language**
* :(fas fa-ellipsis-h): **Pagination** support * :(fas fa-ellipsis-h): **Pagination** supported
* :(far fa-list-alt): Easy-to-use and self-expanding **table of contents** * :(far fa-list-alt): Easy-to-use and self-expanding **table of contents**
* :(fas fa-language): **Multilanguage** support and i18n ready * :(fas fa-language): **Multilanguage** supported and i18n ready
* :(fab fa-css3-alt): Beautiful **CSS animation** * :(fab fa-css3-alt): Beautiful **CSS animation**
#### Social and Comment Systems #### Social and Comment Systems
* :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com) * :(far fa-user): **Gravatar** supported by [Gravatar](https://gravatar.com)
* :(fas fa-user-circle): Local **Avatar** support * :(fas fa-user-circle): Local **Avatar** supported
* :(far fa-id-card): Up to **61** social sites supported * :(far fa-id-card): Up to **61** social links supported
* :(fas fa-share-square): Up to **28** share sites support * :(fas fa-share-square): Up to **28** share sites supported
* :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com) * :(far fa-comment): **Disqus** comment system supported by [Disqus](https://disqus.com)
* :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk) * :(far fa-comment-dots): **Gitalk** comment system supported by [Gitalk](https://github.com/gitalk/gitalk)
* :(far fa-comment-alt): **Valine** comment system supported by [Valine](https://valine.js.org/) * :(far fa-comment-alt): **Valine** comment system supported by [Valine](https://valine.js.org/)
* :(far fa-comments): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/) * :(far fa-comments): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* :(fas fa-comments): **Telegram Comments** system supported by [Comments](https://comments.app/)
#### Extended Features #### Extended Features

View File

@@ -50,6 +50,7 @@ lightgallery: true
* :(far fa-comment-dots): 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统 * :(far fa-comment-dots): 支持 **[Gitalk](https://github.com/gitalk/gitalk)** 评论系统
* :(far fa-comment-alt): 支持 **[Valine](https://valine.js.org/)** 评论系统 * :(far fa-comment-alt): 支持 **[Valine](https://valine.js.org/)** 评论系统
* :(far fa-comments): 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统 * :(far fa-comments): 支持 **[Facebook](https://developers.facebook.com/docs/plugins/comments/) 评论**系统
* :(fas fa-comments): 支持 **[Telegram Comments](https://comments.app/) 评论**系统
#### 扩展功能 #### 扩展功能

View File

@@ -385,6 +385,17 @@ Note that some of these parameters are explained in details in other sections of
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "en_US" languageCode = "en_US"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} Config
[params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
# site verification code for Google/Bing/Yandex/Pinterest/Baidu # site verification code for Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]

View File

@@ -390,6 +390,17 @@ Note that some of these parameters are explained in details in other sections of
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "en_US" languageCode = "en_US"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} Config
[params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
# site verification code for Google/Bing/Yandex/Pinterest/Baidu # site verification code for Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]

View File

@@ -386,7 +386,18 @@ hugo
width = "100%" width = "100%"
numPosts = 10 numPosts = 10
appId = "" appId = ""
languageCode = "en_US" languageCode = "zh_CN"
# {{< version 0.2.0 >}}
# {{< link "https://comments.app/" "Telegram Comments" >}} 评论系统设置
[params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu # 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification] [params.verification]

View File

@@ -113,4 +113,14 @@
Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a> Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a>
</noscript> </noscript>
{{- end -}} {{- end -}}
{{- /* Telegram Comments System */ -}}
{{- if .Site.Params.comment.telegram.enable -}}
{{- $telegram := .Site.Params.comment.telegram -}}
<div id="telegram-comments" class="comment"></div>
<script async src="https://comments.app/js/widget.js?2" data-comments-app-website="{{ $telegram.siteID }}" data-limit="{{ $telegram.limit | default 5 }}"{{ with $telegram.height }} data-height="{{ . }}"{{ end }}{{ with $telegram.color }} data-color="{{ . }}"{{ end }}{{ if $telegram.colorful }} data-colorful="1"{{ end }}{{ if $telegram.dislikes }} data-dislikes="1"{{ end }}{{ if $telegram.outlined }} data-outlined="1"{{ end }}></script>
<noscript>
Please enable JavaScript to view the <a href="https://comments.app/">comments powered by Telegram Comments.</a>
</noscript>
{{- end -}}
{{- end -}} {{- end -}}