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

shaked8634
25.20.2024 d86f70a1791b47c6ffa76355e4e1d88d20e61d3f
Added support + doc to Cusdis (#907)

### Prerequisites

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

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

### Description

Describe what this pull request achieves.

### Issues Resolved
This PR adds support for Cusdis commenting system
List any existing issues this pull request resolves.
Addresses #896
### Checklist

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

#### General

- [X] Describe what changes are being made
Added partial to call Cusdis JS + added ref to load partial + added
documentation
[X] Explain why and how the changes were necessary and implemented
respectively
I started using Cusdis and I see there some demands for it.
- [X] Reference issue with `#<ISSUE_NO>` if applicable
#896
#### 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

---------

Co-authored-by: Luiz F. A. de PrĂ¡ <luizdepra@users.noreply.github.com>
3 files modified
1 files added
29 ■■■■■ changed files
CONTRIBUTORS.md 3 ●●●● patch | view | raw | blame | history
docs/configurations.md 9 ●●●●● patch | view | raw | blame | history
layouts/partials/posts/cusdis.html 16 ●●●●● patch | view | raw | blame | history
layouts/posts/single.html 1 ●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -139,5 +139,6 @@
- [Jens Rantil](https://github.com/JensRantil)
- [Muqeet Malik](https://github.com/mmalik23)
- [Sammy44nts](https://github.com/sammy44nts)
- [Shaked8634](https://github.com/shaked8634)
- [Leo Heimann Ruiz](https://leo.heitmannruiz.org/)
- [Antoine "Toinux" Wam](https://github.com/itzwam)
- [Antoine "Toinux" Wam](https://github.com/itzwam)
docs/configurations.md
@@ -7,6 +7,7 @@
    * [Commento](#commento)
    * [Utterances](#utterances)
    * [Giscus](#giscus)
    * [Cusdis](#cusdis)
* [Syntax Highlight](#syntax-highlight)
* [Theme Parameters](#theme-parameters)
  * [Social Icons Configuration](#social-icons-configuration)
@@ -27,6 +28,7 @@
  * [Commento](https://commento.io/)
  * [Utterances](https://utteranc.es/)
  * [Giscus](https://giscus.app/)
  * [Cusdis](https://cusdis.com/)
  * [Telegram](https://comments.app/)
### Commenting Systems
@@ -87,6 +89,13 @@
  dark = ""
```
#### Cusdis
```toml
[params.cusdis] # https://cusdis.com
  data_app_id = ""
```
## 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`:
layouts/partials/posts/cusdis.html
New file
@@ -0,0 +1,16 @@
{{- if isset .Site.Params "cusdis" -}}
    {{- if and (isset .Site.Params.cusdis "data_app_id") (eq (.Params.disableComments | default false) false) -}}
        <div class="comments">
            <h4>Comments:</h4>
            <div id="cusdis_thread"
                 data-host="https://cusdis.com"
                 data-app-id="{{ .Site.Params.cusdis.data_app_id }}"
                 data-page-id="{{ .File.UniqueID }}"
                 data-page-url="{{ .Permalink }}"
                 data-page-title="{{ .Title }}">
            </div>
            <script async defer src="https://cusdis.com/js/cusdis.es.js"></script>
        </div>
    {{- end -}}
{{- end -}}
layouts/posts/single.html
@@ -47,6 +47,7 @@
        {{ partial "posts/giscus.html" . }}
        {{ partial "posts/mastodon.html" . }}
        {{ partial "posts/telegram.html" . }}
        {{ partial "posts/cusdis.html" . }}
      </footer>
    </article>