feat: add support for Isso comments

main
welpo 2 years ago
parent e1dfd2ea07
commit 9a98789922
No known key found for this signature in database
GPG Key ID: A2F978CF4EC1F5A6

@ -224,3 +224,19 @@ page_id_is_slug = true # If true, it will use the post's filename (slug) as id;
lang = "" # Leave blank to match the page's language. lang = "" # Leave blank to match the page's language.
page_author = "" # Email (or base64 encoded email) of the author. page_author = "" # Email (or base64 encoded email) of the author.
lazy_loading = true lazy_loading = true
# Isso support for comments. https://isso-comments.de/
# You need to self-host the backend first: https://blog.phusion.nl/2018/08/16/isso-simple-self-hosted-commenting-system/
# More info on some settings: https://isso-comments.de/docs/reference/client-config/
[extra.isso]
enabled_for_all_posts = false # Enables Isso on all posts. It can be enabled on individual posts by setting `isso = true` in the [extra] section of a post's front matter.
automatic_loading = true # If set to false, a "Load comments" button will be shown.
endpoint_url = "" # Accepts relative paths like "/comments/" or "/isso/", as well as full urls like "https://example.com/comments/". Include the trailing slash.
page_id_is_slug = true # If true, it will use the post's filename (slug) as id; this is the only way to share comments between languages. If false, it will use the entire url as id.
lang = "" # Leave blank to match the page's language.
max_comments_top = "inf" # Number of top level comments to show by default. If some comments are not shown, an “X Hidden” link is shown.
max_comments_nested = "5" # Number of nested comments to show by default. If some comments are not shown, an “X Hidden” link is shown.
avatar = true
voting = true
page_author_hashes = "" # hash (or list of hashes) of the author.
lazy_loading = true # Loads when the comments are in the viewport (using the Intersection Observer API).

@ -1,7 +1,7 @@
+++ +++
title = "Afegeix comentaris a les teves publicacions amb giscus, utterances o Hyvor Talk" title = "Afegeix comentaris a les teves publicacions amb giscus, utterances o Hyvor Talk"
date = 2023-07-14 date = 2023-07-14
updated = 2023-07-16 updated = 2023-07-26
description = "Descobreix com habilitar una secció de comentaris a les teves publicacions utilitzant giscus, utterances o Hyvor Talk, permetent la interacció i feedback dels lectors." description = "Descobreix com habilitar una secció de comentaris a les teves publicacions utilitzant giscus, utterances o Hyvor Talk, permetent la interacció i feedback dels lectors."
[taxonomies] [taxonomies]
@ -10,9 +10,10 @@ tags = ["funcionalitat", "tutorial"]
[extra] [extra]
giscus = true giscus = true
quick_navigation_buttons = true quick_navigation_buttons = true
toc = true
+++ +++
tabi actualment suporta tres sistemes de comentaris: [giscus](https://giscus.app/ca) i [utterances](https://utteranc.es/) i [Hyvor Talk](https://talk.hyvor.com/). tabi actualment suporta quatre sistemes de comentaris: [giscus](https://giscus.app/ca) i [utterances](https://utteranc.es/), [Hyvor Talk](https://talk.hyvor.com/) i [Isso](https://isso-comments.de/).
giscus i utterances són projectes de codi obert que et permeten afegir una secció de comentaris al teu lloc web utilitzant les «issues» (utterances) o «discussions» (giscus) de GitHub. Són perfectes per a generadors de llocs estàtics com Zola, ja que permeten als teus lectors interactuar i deixar comentaris a les teves publicacions sense requerir un backend tradicional o una base de dades. giscus i utterances són projectes de codi obert que et permeten afegir una secció de comentaris al teu lloc web utilitzant les «issues» (utterances) o «discussions» (giscus) de GitHub. Són perfectes per a generadors de llocs estàtics com Zola, ja que permeten als teus lectors interactuar i deixar comentaris a les teves publicacions sense requerir un backend tradicional o una base de dades.
@ -28,6 +29,8 @@ Ambdues són excel·lents eines per afegir comentaris al teu blog, però giscus
Hyvor Talk és una plataforma de comentaris de pagament centrada en la privadesa. Ofereix tots els avantatges del giscus i alguns més, com la moderació i la detecció de correu brossa. Hyvor Talk és una plataforma de comentaris de pagament centrada en la privadesa. Ofereix tots els avantatges del giscus i alguns més, com la moderació i la detecció de correu brossa.
Isso és un sistema de comentaris de codi obert autoallotjat que emmagatzema els comentaris a la seva pròpia base de dades. Un dels seus principals avantatges és la privacitat; no comparteix les dades dels usuaris amb tercers. També té una interfície lleugera i neta, facilitant als teus visitants deixar comentaris. Isso també permet comentaris anònims, potencialment augmentant la participació dels usuaris a la teva pàgina web.
## Configuració ## Configuració
### Sistemes basats en GitHub ### Sistemes basats en GitHub
@ -86,11 +89,30 @@ page_author = "" # Correu (o correu codificat en base64) de l'autor.
lazy_loading = true lazy_loading = true
``` ```
### Isso
Per habilitar Isso, primer hauràs d'instal·lar i executar un servidor Isso ([aquí tens una guia útil](https://blog.phusion.nl/2018/08/16/isso-simple-self-hosted-commenting-system/#1installingisso)). Després, completa aquestes configuracions a `config.toml`:
```toml
[extra.isso]
enabled_for_all_posts = false
automatic_loading = true
endpoint_url = "https://example.com/comments/" # URL a Isso.
page_id_is_slug = true
lang = ""
max_comments_top = "inf"
max_comments_nested = "5"
avatar = true
voting = true
page_author_hashes = ""
lazy_loading = true
```
### Configuracions comunes ### Configuracions comunes
La opció `enabled_for_all_posts = true` habilita globalment el sistema de comentaris corresponent. La opció `enabled_for_all_posts = true` habilita globalment el sistema de comentaris corresponent.
Alternativament, pots habilitar els comentaris a publicacions concretes afegint el nom del sistema (`utterances`, `giscus` o `hyvortalk`) ` = true`. Per exemple, així és com habilitaries giscus: Alternativament, pots habilitar els comentaris a publicacions concretes afegint el nom del sistema (`utterances`, `giscus`, `hyvortalk` o `isso`) ` = true`. Per exemple, així és com habilitaries giscus:
```toml,hl_lines=09-10 ```toml,hl_lines=09-10
+++ +++
@ -108,7 +130,7 @@ giscus = true
Si accidentalment habilites més d'un sistema, Zola mostrarà un error. Si accidentalment habilites més d'un sistema, Zola mostrarà un error.
Si el teu lloc web té múltiples idiomes amb publicacions coincidents (com aquesta demo), i t'agradaria compartir comentaris entre idiomes, has d'utilitzar `issue_term = "slug"` (per giscus y utterances) o `page_id_is_slug = true` (per Hyvor Talk). Això utilitzarà el nom de l'arxiu Markdown (sense l'etiqueta d'idioma) com a identificador. Totes les altres opcions crearan diferents seccions de comentaris per a cada idioma. Si el teu lloc web té múltiples idiomes amb publicacions coincidents (com aquesta demo), i t'agradaria compartir comentaris entre idiomes, has d'utilitzar `issue_term = "slug"` (per giscus y utterances) o `page_id_is_slug = true` (per Hyvor Talk o Isso). Això utilitzarà el nom de l'arxiu Markdown (sense l'etiqueta d'idioma) com a identificador. Totes les altres opcions crearan diferents seccions de comentaris per a cada idioma.
## Exemple en viu ## Exemple en viu

@ -1,7 +1,7 @@
+++ +++
title = "Añade comentarios a tus publicaciones con giscus, utterances o Hyvor Talk" title = "Añade comentarios a tus publicaciones con giscus, utterances o Hyvor Talk"
date = 2023-07-14 date = 2023-07-14
updated = 2023-07-17 updated = 2023-07-26
description = "Descubre cómo habilitar una sección de comentarios en tus publicaciones usando giscus, utterances o Hyvor Talk, permitiendo la interacción y feedback de los lectores." description = "Descubre cómo habilitar una sección de comentarios en tus publicaciones usando giscus, utterances o Hyvor Talk, permitiendo la interacción y feedback de los lectores."
[taxonomies] [taxonomies]
@ -10,9 +10,10 @@ tags = ["funcionalidad", "tutorial"]
[extra] [extra]
giscus = true giscus = true
quick_navigation_buttons = true quick_navigation_buttons = true
toc = true
+++ +++
tabi actualmente soporta tres sistemas de comentarios: [giscus](https://giscus.app/es) y [utterances](https://utteranc.es/) y [Hyvor Talk](https://talk.hyvor.com/). tabi actualmente soporta cuatro sistemas de comentarios: [giscus](https://giscus.app/es) y [utterances](https://utteranc.es/), [Hyvor Talk](https://talk.hyvor.com/) e [Isso](https://isso-comments.de/).
giscus y utterances son proyectos de código abierto que te permiten añadir una sección de comentarios a tu sitio web usando las «issues» (utterances) o «discussions» (giscus) de GitHub. Son perfectos para generadores de sitios estáticos como Zola, ya que permiten a tus lectores interactuar y dejar comentarios en tus publicaciones sin requerir un backend tradicional ni una base de datos. giscus y utterances son proyectos de código abierto que te permiten añadir una sección de comentarios a tu sitio web usando las «issues» (utterances) o «discussions» (giscus) de GitHub. Son perfectos para generadores de sitios estáticos como Zola, ya que permiten a tus lectores interactuar y dejar comentarios en tus publicaciones sin requerir un backend tradicional ni una base de datos.
@ -28,6 +29,8 @@ Ambas son excelentes herramientas para agregar comentarios a tu blog, pero giscu
Hyvor Talk es una plataforma de comentarios de pago centrada en la privacidad. Ofrece todas las ventajas de giscus y algunas más, como moderación y detección de spam. Hyvor Talk es una plataforma de comentarios de pago centrada en la privacidad. Ofrece todas las ventajas de giscus y algunas más, como moderación y detección de spam.
Isso es un sistema de comentarios de código abierto y autoalojado que almacena los comentarios en su propia base de datos. Una de sus principales ventajas es la privacidad; no comparte los datos de los usuarios con terceros. También tiene una interfaz ligera y limpia, lo que facilita que tus visitantes dejen comentarios. Isso también permite comentarios anónimos, lo que podría aumentar la participación de los usuarios en tu sitio web.
## Configuración ## Configuración
### Sistemas basados en GitHub ### Sistemas basados en GitHub
@ -87,11 +90,30 @@ page_author = "" # Correo (o correo codificado en base64) del autor.
lazy_loading = true lazy_loading = true
``` ```
### Isso
Para habilitar Isso, primero necesitarás instalar y ejecutar un servidor Isso ([aquí tienes una guía útil](https://blog.phusion.nl/2018/08/16/isso-simple-self-hosted-commenting-system/#1installingisso)). Luego, completa estas configuraciones en `config.toml`:
```toml
[extra.isso]
enabled_for_all_posts = false
automatic_loading = true
endpoint_url = "https://example.com/comments/" # URL a Isso.
page_id_is_slug = true
lang = ""
max_comments_top = "inf"
max_comments_nested = "5"
avatar = true
voting = true
page_author_hashes = ""
lazy_loading = true
```
### Ajustes comunes ### Ajustes comunes
La opción `enabled_for_all_posts = true` habilitará globalmente el sistema de comentarios correspondiente. La opción `enabled_for_all_posts = true` habilitará globalmente el sistema de comentarios correspondiente.
Alternativamente, puedes habilitar los comentarios en publicaciones concretas añadiendo el nombre del sistema (`utterances`, `giscus` o `hyvortalk`) `= true`. Por ejemplo, así habilitarías giscus: Alternativamente, puedes habilitar los comentarios en publicaciones concretas añadiendo el nombre del sistema (`utterances`, `giscus`, `hyvortalk` o `isso`) `= true`. Por ejemplo, así habilitarías giscus:
```toml,hl_lines=09-10 ```toml,hl_lines=09-10
+++ +++
@ -109,7 +131,7 @@ giscus = true
Si accidentalmente habilitas más de un sistema, Zola mostrará un error. Si accidentalmente habilitas más de un sistema, Zola mostrará un error.
Si tu web tiene múltiples idiomas con publicaciones coincidentes (como esta demo), y te gustaría compartir comentarios entre idiomas, debes usar `issue_term = "slug"` (en el caso de giscus y utterances) o `page_id_is_slug = true` (para Hyvor Talk). Esto usará el nombre del archivo Markdown (sin la etiqueta de idioma) como identificador. Todas las demás opciones crearán diferentes secciones de comentarios para cada idioma. Si tu web tiene múltiples idiomas con publicaciones coincidentes (como esta demo), y te gustaría compartir comentarios entre idiomas, debes usar `issue_term = "slug"` (en el caso de giscus y utterances) o `page_id_is_slug = true` (para Hyvor Talk e Isso). Esto usará el nombre del archivo Markdown (sin la etiqueta de idioma) como identificador. Todas las demás opciones crearán diferentes secciones de comentarios para cada idioma.
## Ejemplo en vivo ## Ejemplo en vivo

@ -1,7 +1,7 @@
+++ +++
title = "Add comments to your posts with giscus, utterances or Hyvor Talk" title = "Add comments to your posts with giscus, utterances or Hyvor Talk"
date = 2023-07-14 date = 2023-07-14
updated = 2023-07-17 updated = 2023-07-26
description = "Discover how to enable a comments section on your posts using giscus, utterances, or Hyvor Talk, enabling reader interaction and feedback." description = "Discover how to enable a comments section on your posts using giscus, utterances, or Hyvor Talk, enabling reader interaction and feedback."
[taxonomies] [taxonomies]
@ -10,9 +10,10 @@ tags = ["showcase", "tutorial"]
[extra] [extra]
giscus = true giscus = true
quick_navigation_buttons = true quick_navigation_buttons = true
toc = true
+++ +++
tabi currently supports three comment systems: [giscus](https://giscus.app/), [utterances](https://utteranc.es/), and [Hyvor Talk](https://talk.hyvor.com/). tabi currently supports four comment systems: [giscus](https://giscus.app/), [utterances](https://utteranc.es/), [Hyvor Talk](https://talk.hyvor.com/), and [Isso](https://isso-comments.de/).
giscus and utterances are open-source projects that let you add a comments section to your website using GitHub issues (utterances) or discussions (giscus). They are perfect for static site generators like Zola, since they enable your readers to interact and leave comments on your posts without requiring a traditional backend or database. giscus and utterances are open-source projects that let you add a comments section to your website using GitHub issues (utterances) or discussions (giscus). They are perfect for static site generators like Zola, since they enable your readers to interact and leave comments on your posts without requiring a traditional backend or database.
@ -28,6 +29,8 @@ Both are great tools for adding comments to your blog, but giscus has a few adva
Hyvor Talk is a paid privacy-focused commenting platform. It offers all of the giscus' advantages, and a few more, like moderation and spam detection. Hyvor Talk is a paid privacy-focused commenting platform. It offers all of the giscus' advantages, and a few more, like moderation and spam detection.
Isso is an open-source self-hosted commenting system that stores comments in its own database. One of its main advantages is privacy; it does not share user data with third parties. It also has a lightweight and clean interface, making it easy for your visitors to leave comments. Isso also allows anonymous comments, potentially increasing user engagement on your website.
## Setup ## Setup
### GitHub based systems ### GitHub based systems
@ -87,11 +90,30 @@ page_author = "" # Email (or base64 encoded email) of the author.
lazy_loading = true lazy_loading = true
``` ```
### Isso
To enable Isso, you'll first need to install and run an Isso server ([here's a useful guide](https://blog.phusion.nl/2018/08/16/isso-simple-self-hosted-commenting-system/#1installingisso)). Then, complete these settings in `config.toml`:
```toml
[extra.isso]
enabled_for_all_posts = false
automatic_loading = true
endpoint_url = "https://example.com/comments/" # URL to Isso host.
page_id_is_slug = true
lang = ""
max_comments_top = "inf"
max_comments_nested = "5"
avatar = true
voting = true
page_author_hashes = ""
lazy_loading = true
```
### Common settings ### Common settings
Setting `enabled_for_all_posts = true` for a comment system will enable it globally. Setting `enabled_for_all_posts = true` for a comment system will enable it globally.
Alternatively, enable comments on an individual post's front matter by adding the name of the system (i.e. `utterances`, `giscus` or `hyvortalk`) `= true`. For example, this is how you would enable giscus: Alternatively, enable comments on an individual post's front matter by adding the name of the system (`utterances`, `giscus`, `hyvortalk`, or `isso`) `= true`. For example, this is how you would enable giscus:
```toml,hl_lines=09-10 ```toml,hl_lines=09-10
+++ +++
@ -109,7 +131,7 @@ giscus = true
If you accidentally enable more than one system, your site will fail to build with an error. If you accidentally enable more than one system, your site will fail to build with an error.
If your site has multiple languages with matching posts (like this demo), and you'd like to share comments between languages, you must use `issue_term = "slug"` (for giscus and utterances) or `page_id_is_slug = true` (for Hyvor Talk). This will use the name of the Markdown file (sans the language tag) as the identifier. All other options will create different comment sections for each language. If your site has multiple languages with matching posts (like this demo), and you'd like to share comments between languages, you must use `issue_term = "slug"` (for giscus and utterances) or `page_id_is_slug = true` (for Hyvor Talk or Isso). This will use the name of the Markdown file (sans the language tag) as the identifier. All other options will create different comment sections for each language.
## Live example ## Live example

@ -18,16 +18,15 @@
} }
.load-comments-button { .load-comments-button {
display: inline-block; display: block;
font-family: var(--sans-serif-font); font-family: var(--sans-serif-font);
color: inherit; color: inherit;
font-size: 0.95rem; font-size: 0.95rem;
background: none; background: none;
border: none; border: none;
padding: 0.5em 1em; padding: 0.5em 1em;
margin: 0.5em; margin: 0.5em auto;
cursor: pointer; cursor: pointer;
text-decoration: none; text-decoration: none;
} }
} }

@ -0,0 +1,322 @@
/* ========================================================================== */
/* Generic styling */
/* ========================================================================== */
#isso-thread * {
/* Reset */
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* ========================================================================== */
/* Thread heading area */
/* ========================================================================== */
#isso-thread {
padding: 0;
margin: 0 auto;
color: var(--text-color);
font-family: var(--sans-serif-font);
font-size: 0.9em;
width: 100%;
}
h4.isso-thread-heading {
font-size: 1.2rem;
color: var(--text-color);
padding-bottom: 0.2em;
}
.isso-feedlink {
float: right;
padding-left: 1em;
}
.isso-feedlink a {
font-size: 0.8em;
vertical-align: bottom;
}
/* ========================================================================== */
/* Comments */
/* ========================================================================== */
.isso-comment {
max-width: 68em;
margin: 0 auto;
}
.isso-preview .isso-comment {
padding-top: 0;
margin: 0;
}
.isso-comment:not(:first-of-type),
.isso-follow-up .isso-comment {
border-top: 1px solid rgba(0, 0, 0, 0.1);
margin-bottom: 0.5em;
}
.isso-avatar {
display: block;
float: left;
margin: 0.95em 0.95em 0;
}
.isso-avatar svg {
max-width: 48px;
max-height: 48px;
width: 100%;
height: 100%;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.isso-text-wrapper {
display: block;
padding: 0.3em;
}
.isso-follow-up {
padding-left: calc(7% + 20px);
}
.isso-comment-footer {
font-size: 0.95em;
}
.isso-comment-header {
font-size: 0.85em;
}
.isso-comment-header a {
text-decoration: none;
}
/* Only for comment header, spacer between up-/downvote should have no padding */
.isso-comment-header .isso-spacer {
padding: 0 6px;
}
.isso-spacer,
.isso-permalink,
.isso-note,
.isso-parent {
color: var(--meta-color);
font-weight: normal;
text-shadow: none;
}
.isso-spacer:hover,
.isso-permalink:hover,
.isso-note:hover,
.isso-parent:hover {
color: #606060;
}
.isso-note {
float: right;
}
.isso-author {
font-weight: 500;
color: var(--text-color);
}
.isso-page-author-suffix {
font-weight: bold;
color: var(--text-color-high-contrast);
}
/* Style author comments and replies */
.isso-is-page-author > .isso-text-wrapper {
background-color: var(--bg-1);
}
.isso-textarea,
.isso-preview {
width: 100%;
padding: 10px;
border: none;
font-family: var(--sans-serif-font);
color: var(--text-color);
background-color: var(--bg-2);
font-size: 0.8em;
}
.isso-text p {
margin-top: -0.4em;
}
.isso-text p:last-child {
margin-bottom: 0.2em;
}
.isso-text h1,
.isso-text h2,
.isso-text h3,
.isso-text h4,
.isso-text h5,
.isso-text h6 {
font-size: 130%;
font-weight: bold;
}
.isso-comment-footer {
font-size: 0.80em;
color: gray;
clear: left;
}
.isso-feedlink,
.isso-comment-footer a {
font-weight: bold;
text-decoration: none;
margin: 0.4em;
padding: 0.1em;
}
.isso-comment-footer .isso-votes {
color: gray;
}
.isso-upvote svg,
.isso-downvote svg {
position: relative;
top: .2em;
}
/* Reply postbox under existing comment */
.isso-comment .isso-postbox {
margin-top: 0.8em;
}
.isso-comment.isso-no-votes > * > .isso-comment-footer .isso-votes {
display: none;
}
/* ========================================================================== */
/* Postbox */
/* ========================================================================== */
.isso-postbox {
max-width: 68em;
margin: 0 auto 2em;
clear: right;
}
.isso-form-wrapper {
display: flex;
flex-direction: column;
}
.isso-textarea,
.isso-preview {
margin-top: 0.2em;
width: 100%;
border: var(--border-color);
border-radius: 5px;
box-shadow: 0 0 2px #888;
}
.isso-textarea {
outline: 0;
width: 100%;
resize: none;
}
.isso-form-wrapper input[type=checkbox] {
vertical-align: middle;
position: relative;
bottom: 1px;
margin-left: 0;
}
.isso-notification-section {
font-size: 0.90em;
padding-top: .3em;
display: none;
padding-bottom: 10px;
}
.isso-auth-section {
display: flex;
flex-direction: row;
}
.isso-textarea:focus,
.isso-auth-section input:focus {
border-color: rgba(0, 0, 0, 0.8);
}
.isso-input-wrapper {
display: inline-block;
position: relative;
font-family: var(--sans-serif-font);
font-size: 0.9em;
max-width: 25%;
margin: 0;
}
.isso-input-wrapper input {
max-width: 100%;
line-height: 1.2em;
padding: 0.3em;
border-radius: 5px;
width: 90%;
font-family: var(--sans-serif-font);
color: var(--text-color);
background-color: var(--bg-2);
border: var(--border-color);
box-shadow: 0 0 2px #888;
}
.isso-input-wrapper label {
display: inline-block;
line-height: 1.4em;
height: 1.4em;
}
.isso-post-action {
display: block;
margin: 0 auto;
align-self: flex-end;
margin-bottom: 0.3em;
}
.isso-post-action > input {
font-size: 0.8rem;
background-color: var(--primary-color);
color: var(--background-color);
border: none;
border-radius: 5px;
cursor: pointer;
padding: 0.6em 1em;
margin: 0.1em;
cursor: pointer;
}
.isso-post-action > input:hover {
background-color: var(--primary-color-dark);
}
/* ========================================================================== */
/* Postbox (preview mode) */
/* ========================================================================== */
.isso-preview,
.isso-post-action input[name="edit"],
.isso-postbox.isso-preview-mode > .isso-form-wrapper input[name="preview"],
.isso-postbox.isso-preview-mode > .isso-form-wrapper .isso-textarea {
display: none;
}
.isso-postbox.isso-preview-mode > .isso-form-wrapper .isso-preview {
display: block;
}
.isso-postbox.isso-preview-mode > .isso-form-wrapper input[name="edit"] {
display: inline;
}
.isso-preview {
background-color: var(--bg-0);
background: repeating-linear-gradient(
-45deg,
var(--bg-0),
var(--bg-0) 10px,
var(--bg-2) 10px,
var(--bg-2) 20px
);
}
/* ========================================================================== */
/* Animations */
/* ========================================================================== */
/* "target" means the comment that's being linked to, for example:
* https://example.com/blog/example/#isso-15
*/
.isso-target {
animation: isso-target-fade 5s ease-out;
}
@keyframes isso-target-fade {
0% { background-color: var(--divider-color) }
}
/* ========================================================================== */
/* Media queries */
/* ========================================================================== */
@media screen and (max-width:600px) {
.isso-auth-section {
flex-direction: column;
text-align: center;
}
.isso-input-wrapper {
display: block;
max-width: 100%;
margin: 0 0 .4em;
}
.isso-input-wrapper input {
width: 100%;
}
.isso-post-action {
margin: 0.4em auto;
width: 60%;
}
}

@ -0,0 +1 @@
#isso-thread *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#isso-thread{padding:0;margin:0 auto;color:var(--text-color);font-family:var(--sans-serif-font);font-size:.9em;width:100%}h4.isso-thread-heading{font-size:1.2rem;color:var(--text-color);padding-bottom:.2em}.isso-feedlink,.isso-note{float:right}.isso-feedlink a{font-size:.8em;vertical-align:bottom}.isso-comment{max-width:68em;margin:0 auto}.isso-preview .isso-comment{padding-top:0;margin:0}.isso-comment:not(:first-of-type),.isso-follow-up .isso-comment{border-top:1px solid rgba(0,0,0,.1);margin-bottom:.5em}.isso-avatar{display:block;float:left;margin:.95em .95em 0}.isso-avatar svg{max-width:48px;max-height:48px;width:100%;height:100%;border:1px solid rgba(0,0,0,.2);border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1)}.isso-text-wrapper{display:block;padding:.3em}.isso-follow-up{padding-left:calc(7% + 20px)}.isso-comment-header{font-size:.85em}.isso-comment-header a{text-decoration:none}.isso-comment-header .isso-spacer{padding:0 6px}.isso-note,.isso-parent,.isso-permalink,.isso-spacer{color:var(--meta-color);font-weight:400;text-shadow:none}.isso-note:hover,.isso-parent:hover,.isso-permalink:hover,.isso-spacer:hover{color:#606060}.isso-author{font-weight:500;color:var(--text-color)}.isso-page-author-suffix{font-weight:700;color:var(--text-color-high-contrast)}.isso-input-wrapper input,.isso-preview,.isso-textarea{font-family:var(--sans-serif-font);color:var(--text-color);background-color:var(--bg-2)}.isso-is-page-author>.isso-text-wrapper{background-color:var(--bg-1)}.isso-preview,.isso-textarea{padding:10px;border:none;font-size:.8em}.isso-text p{margin-top:-.4em}.isso-text p:last-child{margin-bottom:.2em}.isso-text h1,.isso-text h2,.isso-text h3,.isso-text h4,.isso-text h5,.isso-text h6{font-size:130%;font-weight:700}.isso-comment-footer{font-size:.8em;color:gray;clear:left}.isso-comment-footer a,.isso-feedlink{font-weight:700;text-decoration:none;margin:.4em;padding:.1em}.isso-comment-footer .isso-votes{color:gray}.isso-downvote svg,.isso-upvote svg{position:relative;top:.2em}.isso-comment .isso-postbox{margin-top:.8em}.isso-comment.isso-no-votes>*>.isso-comment-footer .isso-votes,.isso-post-action input[name=edit],.isso-postbox.isso-preview-mode>.isso-form-wrapper .isso-textarea,.isso-postbox.isso-preview-mode>.isso-form-wrapper input[name=preview],.isso-preview{display:none}.isso-postbox{max-width:68em;margin:0 auto 2em;clear:right}.isso-form-wrapper{display:flex;flex-direction:column}.isso-preview,.isso-textarea{margin-top:.2em;width:100%;border:var(--border-color);border-radius:5px;box-shadow:0 0 2px #888}.isso-textarea{outline:0;width:100%;resize:none}.isso-form-wrapper input[type=checkbox]{vertical-align:middle;position:relative;bottom:1px;margin-left:0}.isso-notification-section{font-size:.9em;padding-top:.3em;display:none;padding-bottom:10px}.isso-auth-section{display:flex;flex-direction:row}.isso-auth-section input:focus,.isso-textarea:focus{border-color:rgba(0,0,0,.8)}.isso-input-wrapper{display:inline-block;position:relative;font-family:var(--sans-serif-font);font-size:.9em;max-width:25%;margin:0}.isso-input-wrapper input{max-width:100%;line-height:1.2em;padding:.3em;border-radius:5px;width:90%;border:var(--border-color);box-shadow:0 0 2px #888}.isso-input-wrapper label{display:inline-block;line-height:1.4em;height:1.4em}.isso-post-action{display:block;margin:0 auto .3em;align-self:flex-end}.isso-post-action>input{font-size:.8rem;background-color:var(--primary-color);color:var(--background-color);border:none;border-radius:5px;padding:.6em 1em;margin:.1em;cursor:pointer}.isso-post-action>input:hover{background-color:var(--primary-color-dark)}.isso-postbox.isso-preview-mode>.isso-form-wrapper .isso-preview{display:block}.isso-postbox.isso-preview-mode>.isso-form-wrapper input[name=edit]{display:inline}.isso-preview{background-color:var(--bg-0);background:repeating-linear-gradient(-45deg,var(--bg-0),var(--bg-0) 10px,var(--bg-2) 10px,var(--bg-2) 20px)}.isso-target{animation:5s ease-out isso-target-fade}@keyframes isso-target-fade{0%{background-color:var(--divider-color)}}@media screen and (max-width:600px){.isso-auth-section{flex-direction:column;text-align:center}.isso-input-wrapper{display:block;max-width:100%;margin:0 0 .4em}.isso-input-wrapper input{width:100%}.isso-post-action{margin:.4em auto;width:60%}}

@ -0,0 +1,80 @@
// Function to initialise Isso.
function initIsso() {
// Get the div that will contain the comments.
const commentsDiv = document.querySelector('.comments');
if (commentsDiv) {
// Get the lazy-loading setting from the div.
const lazyLoading = commentsDiv.getAttribute('data-lazy-loading') === "true";
// If lazy-loading is enabled, create an Intersection Observer and use it.
if (lazyLoading) {
const observer = new IntersectionObserver(entries => {
// Loop over the entries.
entries.forEach(entry => {
// If the element is in the viewport, initialize Isso.
if (entry.isIntersecting) {
loadIsso(commentsDiv);
// Once the Isso is loaded, we don't need to observe the element anymore.
observer.unobserve(commentsDiv);
}
});
});
// Start observing the comments div.
observer.observe(commentsDiv);
} else {
// If lazy-loading is not enabled, initialise Isso immediately.
loadIsso(commentsDiv);
}
}
}
// Function to load Isso.
function loadIsso(commentsDiv) {
// Get the various settings from data attributes on the div.
const endpointUrl = commentsDiv.getAttribute('data-endpoint-url');
const pageId = commentsDiv.getAttribute('data-isso-id');
const title = commentsDiv.getAttribute('data-title');
const lang = commentsDiv.getAttribute('data-page-language');
const maxCommentsTop = commentsDiv.getAttribute('data-max-comments-top');
const maxCommentsNested = commentsDiv.getAttribute('data-max-comments-nested');
const avatar = commentsDiv.getAttribute('data-avatar');
const voting = commentsDiv.getAttribute('data-voting');
const hashes = commentsDiv.getAttribute('data-page-author-hashes');
// Create a new script tag that will load the Isso script.
const script = document.createElement('script');
script.src = endpointUrl + 'js/embed.min.js';
script.async = true;
// Set the various settings as data attributes on the script tag.
script.setAttribute('data-isso', endpointUrl);
script.setAttribute('data-isso-lang', lang);
script.setAttribute('data-isso-max-comments-top', maxCommentsTop);
script.setAttribute('data-isso-avatar', avatar);
script.setAttribute('data-isso-vote', voting);
script.setAttribute('data-isso-page-author-hashes', hashes);
script.setAttribute('data-isso-css', 'false');
// Set the id and data-isso-id of the Isso thread.
const section = document.createElement('section');
section.id = 'isso-thread';
section.setAttribute('data-isso-id', pageId);
section.setAttribute('data-title', title);
commentsDiv.appendChild(section);
// Add the script tag to the div.
commentsDiv.appendChild(script);
// Create a link tag for the Isso CSS.
const link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/isso.min.css';
// Add the CSS link tag to the head of the document.
document.head.appendChild(link);
}
// Initialize Isso.
initIsso();

@ -0,0 +1 @@
function initIsso(){const e=document.querySelector(".comments");if(e)if("true"===e.getAttribute("data-lazy-loading")){const a=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting&&(loadIsso(e),a.unobserve(e))})});a.observe(e)}else loadIsso(e)}function loadIsso(t){var e=t.getAttribute("data-endpoint-url"),a=t.getAttribute("data-isso-id"),s=t.getAttribute("data-title"),i=t.getAttribute("data-page-language"),o=t.getAttribute("data-max-comments-top"),r=(t.getAttribute("data-max-comments-nested"),t.getAttribute("data-avatar")),d=t.getAttribute("data-voting"),n=t.getAttribute("data-page-author-hashes"),u=document.createElement("script"),e=(u.src=e+"js/embed.min.js",u.async=!0,u.setAttribute("data-isso",e),u.setAttribute("data-isso-lang",i),u.setAttribute("data-isso-max-comments-top",o),u.setAttribute("data-isso-avatar",r),u.setAttribute("data-isso-vote",d),u.setAttribute("data-isso-page-author-hashes",n),u.setAttribute("data-isso-css","false"),document.createElement("section")),i=(e.id="isso-thread",e.setAttribute("data-isso-id",a),e.setAttribute("data-title",s),t.appendChild(e),t.appendChild(u),document.createElement("link"));i.rel="stylesheet",i.type="text/css",i.href="/isso.min.css",document.head.appendChild(i)}initIsso();

@ -13,7 +13,7 @@ function setTheme(theme, saveToLocalStorage = false) {
localStorage.setItem("theme", theme); localStorage.setItem("theme", theme);
} }
// Dispatch a custom event for utterances and giscus. // Dispatch a custom event for comment systems.
const event = new CustomEvent("themeChanged", { const event = new CustomEvent("themeChanged", {
detail: { theme: theme } detail: { theme: theme }
}); });

@ -1,8 +1,8 @@
{%- macro add_comments(comment_system, automatic_loading) -%} {%- macro add_comments(comment_system, automatic_loading) -%}
<div id="comments" class="comments centered-text" <div id="comments" class="comments"
{% if comment_system == "giscus" %} {% if comment_system == "giscus" %}
{# Store required giscus data attributes in the div #}
data-repo="{{ config.extra.giscus.repo }}" data-repo="{{ config.extra.giscus.repo }}"
data-repo-id="{{ config.extra.giscus.repo_id }}" data-repo-id="{{ config.extra.giscus.repo_id }}"
data-category="{{ config.extra.giscus.category }}" data-category="{{ config.extra.giscus.category }}"
@ -27,10 +27,10 @@
{% else %} {% else %}
data-lang="{{ lang }}" data-lang="{{ lang }}"
{% endif %} {% endif %}
data-lazy-loading="{{ config.extra.giscus.lazy_loading | default(value=true) }}"> data-lazy-loading="{{ config.extra.giscus.lazy_loading }}"
>
{% elif comment_system == "utterances" %} {% elif comment_system == "utterances" %}
{# Store required utterances data attributes in the div #}
data-repo="{{ config.extra.utterances.repo }}" data-repo="{{ config.extra.utterances.repo }}"
{% if config.extra.utterances.issue_term == "slug" %} {% if config.extra.utterances.issue_term == "slug" %}
data-issue-term="{{ page.slug }}" data-issue-term="{{ page.slug }}"
@ -40,10 +40,10 @@
data-label="{{ config.extra.utterances.label }}" data-label="{{ config.extra.utterances.label }}"
data-light-theme="{{ config.extra.utterances.light_theme }}" data-light-theme="{{ config.extra.utterances.light_theme }}"
data-dark-theme="{{ config.extra.utterances.dark_theme }}" data-dark-theme="{{ config.extra.utterances.dark_theme }}"
data-lazy-loading="{{ config.extra.utterances.lazy_loading | default(value=true) }}"> data-lazy-loading="{{ config.extra.utterances.lazy_loading }}"
>
{% elif comment_system == "hyvortalk" %} {% elif comment_system == "hyvortalk" %}
{# Store required Hyvor Talk data attributes in the div #}
data-website-id="{{ config.extra.hyvortalk.website_id }}" data-website-id="{{ config.extra.hyvortalk.website_id }}"
{% if config.extra.hyvortalk.page_id_is_slug %} {% if config.extra.hyvortalk.page_id_is_slug %}
data-page-id="{{ page.slug }}" data-page-id="{{ page.slug }}"
@ -57,10 +57,30 @@
{% endif %} {% endif %}
data-page-author="{{ config.extra.hyvortalk.page_author }}" data-page-author="{{ config.extra.hyvortalk.page_author }}"
{% if config.extra.hyvortalk.lazy_loading %} {% if config.extra.hyvortalk.lazy_loading %}
data-loading="lazy"> data-loading="lazy"
{% else %}
data-loading="default"
{% endif %}
>
{% elif comment_system == "isso" %}
data-endpoint-url="{{ config.extra.isso.endpoint_url }}"
{% if config.extra.isso.page_id_is_slug %}
data-isso-id="{{ page.slug }}"
data-title="{{ page.slug }}"
{% endif %}
{% if config.extra.isso.lang %}
data-page-language="{{ config.extra.isso.lang }}"
{% else %} {% else %}
data-loading="default"> data-page-language="{{ lang }}"
{% endif %} {% endif %}
data-max-comments-top="{{ config.extra.isso.max_comments_top }}"
data-max-comments-nested="{{ config.extra.isso.max_comments_nested }}"
data-avatar="{{ config.extra.isso.avatar }}"
data-voting="{{ config.extra.isso.voting }}"
data-page-author-hashes="{{ config.extra.isso.page_author_hashes }}"
data-lazy-loading="{{ config.extra.isso.lazy_loading }}"
>
{% endif %} {% endif %}
{% if automatic_loading %} {% if automatic_loading %}

@ -84,16 +84,33 @@
{% set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus %} {% set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus %}
{% set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances %} {% set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances %}
{% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %} {% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %}
{% set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso %}
{# Ensure only one comment system is enabled #} {# Ensure only one comment system is enabled #}
{% if giscus_enabled and utterances_enabled or giscus_enabled and hyvortalk_enabled or utterances_enabled and hyvortalk_enabled %} {# Counter for enabled comment systems #}
{{ throw(message="ERROR: Multiple comment systems have been enabled for the same page. Check your config.toml and individual page settings to ensure only one comment system is activated at a time.") }} {% set enabled_systems = 0 %}
{% elif giscus_enabled %}
{# Check and count the enabled comment systems #}
{% if giscus_enabled %}
{% set comment_system = "giscus" %} {% set comment_system = "giscus" %}
{% elif utterances_enabled %} {% set enabled_systems = enabled_systems + 1 %}
{% endif %}
{% if utterances_enabled %}
{% set comment_system = "utterances" %} {% set comment_system = "utterances" %}
{% elif hyvortalk_enabled %} {% set enabled_systems = enabled_systems + 1 %}
{% endif %}
{% if hyvortalk_enabled %}
{% set comment_system = "hyvortalk" %} {% set comment_system = "hyvortalk" %}
{% set enabled_systems = enabled_systems + 1 %}
{% endif %}
{% if isso_enabled %}
{% set comment_system = "isso" %}
{% set enabled_systems = enabled_systems + 1 %}
{% endif %}
{# Ensure only one comment system is enabled #}
{% if enabled_systems > 1 %}
{{ throw(message="ERROR: Multiple comment systems have been enabled for the same page. Check your config.toml and individual page settings to ensure only one comment system is activated at a time.") }}
{% endif %} {% endif %}
{% if comment_system %} {% if comment_system %}

@ -73,12 +73,15 @@
{%- if config.extra.allowed_domains -%} {%- if config.extra.allowed_domains -%}
; ;
{# Check if a comment system is enabled to allow the necessary domains and directives #} {# Check if a comment system is enabled to allow the necessary domains and directives #}
{%- set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances -%} {% set utterances_enabled = config.extra.utterances.enabled_for_all_posts or page.extra.utterances %}
{%- set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus -%} {% set giscus_enabled = config.extra.giscus.enabled_for_all_posts or page.extra.giscus %}
{% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %} {% set hyvortalk_enabled = config.extra.hyvortalk.enabled_for_all_posts or page.extra.hyvortalk %}
{% set isso_enabled = config.extra.isso.enabled_for_all_posts or page.extra.isso %}
{% if hyvortalk_enabled %} {% if hyvortalk_enabled %}
connect-src talk.hyvor.com; connect-src talk.hyvor.com;
{% elif isso_enabled %}
connect-src {{ config.extra.isso.endpoint_url }};
{% endif %} {% endif %}
{%- for domain in config.extra.allowed_domains -%} {%- for domain in config.extra.allowed_domains -%}
@ -95,6 +98,11 @@
{%- elif hyvortalk_enabled %} talk.hyvor.com {%- elif hyvortalk_enabled %} talk.hyvor.com
{%- endif %} {%- endif %}
{%- endif -%} {%- endif -%}
{%- if domain.directive == "script-src" -%}
{%- if isso_enabled %} {{ config.extra.isso.endpoint_url }}
{%- endif %}
{%- endif -%}
{%- if not loop.last -%} {%- if not loop.last -%}
; ;
{%- endif -%} {%- endif -%}

Loading…
Cancel
Save