mirror of https://github.com/luizdepra/hugo-coder.git

Kirill
03.12.2023 20587946309259bd1426316cefb78c28245baca6
Add Telegram Commenting Systems and fix Russian translation (#817)

### Prerequisites

Put an `x` into the box(es) that apply:

- [X] This pull request fixes a bug.
- [X] This pull request adds a feature.
- [ ] This pull request introduces breaking change.

### Description

With the Comments.App tool, site owners can add a comment widget to
their site. With it, Telegram users can leave comments, attach images to
them, give likes and dislikes, and reply to other commenters.

### Issues Resolved

The ending of one of the words did not fit the context.

### Checklist

Put an `x` into the box(es) that apply:

#### General

- [X] Describe what changes are being made
- [X] Explain why and how the changes were necessary and implemented
respectively
- [ ] Reference issue with `#<ISSUE_NO>` if applicable

#### Resources

- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files

#### Contributors

- [X] Add yourself to `CONTRIBUTORS.md` if you aren't on it already
3 files modified
1 files added
40 ■■■■■ changed files
docs/configurations.md 15 ●●●●● patch | view | raw | blame | history
i18n/ru.toml 2 ●●● patch | view | raw | blame | history
layouts/partials/posts/telegram.html 22 ●●●●● patch | view | raw | blame | history
layouts/posts/single.html 1 ●●●● patch | view | raw | blame | history
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`:
i18n/ru.toml
@@ -38,7 +38,7 @@
other = "Работает на"
[see_also]
other = "Также смотреть"
other = "Также смотрите"
[note]
other = "заметка"
layouts/partials/posts/telegram.html
New file
@@ -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 -}}
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>