From 20587946309259bd1426316cefb78c28245baca6 Mon Sep 17 00:00:00 2001
From: Kirill <ponfertato@ya.ru>
Date: Sun, 02 Jul 2023 23:12:52 +0000
Subject: [PATCH] Add Telegram Commenting Systems and fix Russian translation (#817)

---
 layouts/posts/single.html            |    1 +
 docs/configurations.md               |   15 +++++++++++++++
 layouts/partials/posts/telegram.html |   22 ++++++++++++++++++++++
 i18n/ru.toml                         |    2 +-
 4 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/docs/configurations.md b/docs/configurations.md
index d6e30a2..fe4e401 100644
--- a/docs/configurations.md
+++ b/docs/configurations.md
@@ -27,6 +27,7 @@
   * [Commento](https://commento.io/)
   * [Utterances](https://utteranc.es/)
   * [Giscus](https://giscus.app/)
+  * [Telegram](https://comments.app/)
 
 ### Commenting Systems
 
@@ -72,6 +73,20 @@
   loading = ""
 ```
 
+#### Telegram
+
+```toml
+[params.telegram] # https://comments.app/
+  siteID = ""
+  limit = ""
+  height = ""
+  color = ""
+  dislikes = ""
+  outlined = ""
+  colorful = ""
+  dark = ""
+```
+
 ## Syntax Highlight
 
 The theme uses the Goldmark syntax highlight system. GitHub light and dark are set as the default styles. To choose a different style, make sure `noClasses` is not set to false (default is true) and add to your `config.toml`:
diff --git a/i18n/ru.toml b/i18n/ru.toml
index e8bb77c..c360fb0 100644
--- a/i18n/ru.toml
+++ b/i18n/ru.toml
@@ -38,7 +38,7 @@
 other = "Работает на"
 
 [see_also]
-other = "Также смотреть"
+other = "Также смотрите"
 
 [note]
 other = "заметка"
diff --git a/layouts/partials/posts/telegram.html b/layouts/partials/posts/telegram.html
new file mode 100644
index 0000000..2cdae65
--- /dev/null
+++ b/layouts/partials/posts/telegram.html
@@ -0,0 +1,22 @@
+{{- if isset .Site.Params "telegram" -}}
+  {{- if and (isset .Site.Params.telegram "siteid") (not (eq .Site.Params.telegram.siteID "" )) (eq (.Params.disableComments | default false) false) -}}
+  <div class="comments">
+    <script>
+
+      let s = document.createElement('script');
+      s.src = 'https://comments.app/js/widget.js?3';
+      s.setAttribute('data-comments-app-website', '{{ .Site.Params.telegram.siteID }}');
+      s.setAttribute('data-limit', '{{ .Site.Params.telegram.limit }}');
+      s.setAttribute('data-height', '{{ .Site.Params.telegram.height }}');
+      s.setAttribute('data-color', '{{ .Site.Params.telegram.color }}');
+      s.setAttribute('data-dislikes', '{{ .Site.Params.telegram.dislikes }}');
+      s.setAttribute('data-outlined', '{{ .Site.Params.telegram.outlined }}');
+      s.setAttribute('data-colorful', '{{ .Site.Params.telegram.colorful }}');
+      s.setAttribute('data-dark', '{{ .Site.Params.telegram.dark }}');
+      document.querySelector('div.comments').innerHTML = '';
+      document.querySelector('div.comments').appendChild(s);
+
+    </script>
+    </div>
+  {{- end -}}
+{{- end -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index f89987c..9716499 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -45,6 +45,7 @@
         {{ partial "posts/commento.html" . }}
         {{ partial "posts/utterances.html" . }}
         {{ partial "posts/giscus.html" . }}
+        {{ partial "posts/telegram.html" . }}
       </footer>
     </article>
 

--
Gitblit v1.10.0