Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
mateus2k2 committed Jun 20, 2024
1 parent e12367e commit 2914db9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
4 changes: 2 additions & 2 deletions mkdocs.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ extra:
- icon: fontawesome/brands/instagram
link: https://www.instagram.com/mateus2k2/
alternate:
- name: pt - Português
- name: Português
link: https://mateus2k2.github.io/blog/pt/
lang: pt-BR
- name: en - English
- name: English
link: https://mateus2k2.github.io/blog/en/
lang: en
analytics:
Expand Down
4 changes: 2 additions & 2 deletions mkdocs.pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ extra:
- icon: fontawesome/brands/instagram
link: https://www.instagram.com/mateus2k2/
alternate:
- name: pt - Português
- name: Português
link: https://mateus2k2.github.io/blog/pt/
lang: pt-BR
- name: en - English
- name: English
link: https://mateus2k2.github.io/blog/en/
lang: en
analytics:
Expand Down
66 changes: 48 additions & 18 deletions overrides/partials/comments.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{% if page.title != "Home" %}
{% set script_src = "https://giscus.app/client.js" %}
{% set repo = "mateus2k2/giscus" %}
{% set repo_id = "R_kgDOMMGa5Q" %}
{% set category = "General" %}
{% set category_id = "DIC_kwDOMMGa5c4CgPIJ" %}
{% set mapping = "pathname" %}
{% set strict = "0" %}
{% set reactions_enabled = "1" %}
{% set emit_metadata = "0" %}
{% set input_position = "bottom" %}
{% set theme = "dark" %}
{% if (page.meta.comments or true) and page.title != "Home" %}

{% if config.theme.language == 'en' %}
<!-- <script defer src="https://appcommento.88367832.xyz/js/commento.js"></script>
<div id="commento"></div> -->

{% if config.theme.language == 'en' %}
{% set lang = "en" %}
{% elif config.theme.language == 'pt-BR' %}
{% elif config.theme.language == 'pt-BR' %}
{% set lang = "pt" %}
{% endif %}
{% endif %}

<script src="{{ script_src }}"
<h2 id="__comments">{{ lang }}</h2>
<!-- Insert generated snippet here -->

<script src="{{ script_src }}"
data-repo="{{ repo }}"
data-repo-id="{{ repo_id }}"
data-category="{{ category }}"
Expand All @@ -31,6 +26,41 @@
data-lang="{{ lang }}"
crossorigin="anonymous"
async>
</script>
</script>

<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]");

// Set palette on initial load
var palette = __md_get("__palette");
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light";

{% endif %}
// Instruct Giscus to set theme
giscus.setAttribute("data-theme", theme);
}

// Register event handlers after document loaded
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]");
ref.addEventListener("change", function() {
var palette = __md_get("__palette");
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate"
? "transparent_dark"
: "light";

// Instruct Giscus to change theme
var frame = document.querySelector(".giscus-frame");
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme: theme } } },
"https://giscus.app"
);
}
});
});
</script>
{% endif %}

0 comments on commit 2914db9

Please sign in to comment.