Files
hello-algo/overrides/partials/comments.html
Yudong Jin b01036b09e Revisit the English version (#1885)
* Update giscus scroller.

* Refine English docs and landing page

* Sync the headings.

* Update landing pages.

* Update the avatar

* Update Acknowledgements

* Update landing pages.

* Update contributors.

* Update

* Fix the formula formatting.

* Fix the glossary.

* Chapter 6. Hashing

* Remove Chinese chars.

* Fix headings.

* Update giscus themes.

* fallback to default giscus theme to solve 429 many requests error.

* Add borders for callouts.

* docs: sync character encoding translations

* Update landing page media layout and i18n
2026-04-10 23:03:03 +08:00

73 lines
2.5 KiB
HTML

{% if page.meta.comments %}
{% if config.theme.language == 'zh' %}
{% set comm = "欢迎在评论区留下你的见解、问题或建议" %}
{% set lang = "zh-CN" %}
{% elif config.theme.language == 'zh-Hant' %}
{% set comm = "歡迎在評論區留下你的見解、問題或建議" %}
{% set lang = "zh-TW" %}
{% elif config.theme.language == 'en' %}
{% set comm = "Feel free to drop your insights, questions or suggestions" %}
{% set lang = "en" %}
{% elif config.theme.language == 'ja' %}
{% set comm = "ご意見、ご質問、ご提案があればぜひコメントしてください" %}
{% set lang = "ja" %}
{% elif config.theme.language == 'ru' %}
{% set comm = "Оставляйте свои идеи, вопросы и предложения в комментариях" %}
{% set lang = "ru" %}
{% endif %}
<!-- Check-in button above comments -->
{% include "partials/checkin.html" ignore missing %}
<h5 align="center" id="__comments">{{ comm }}</h5>
<!-- Insert generated snippet here -->
<script
src="https://giscus.app/client.js"
data-repo="krahets/hello-algo"
data-repo-id="R_kgDOIXtSqw"
data-category="Announcements"
data-category-id="DIC_kwDOIXtSq84CSZk_"
data-mapping="pathname"
data-strict="1"
data-reactions-enabled="1"
data-emit-metadata="1"
data-input-position="top"
data-theme="light"
data-lang="{{ lang }}"
crossorigin="anonymous"
async
>
</script>
<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")
function getGiscusTheme() {
var palette = __md_get("__palette")
var isDark = palette && typeof palette.color === "object" && palette.color.scheme === "slate"
return isDark ? "noborder_dark" : "light"
}
/* Set palette on initial load */
giscus.setAttribute("data-theme", getGiscusTheme())
/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
if (!ref) return
ref.addEventListener("change", function() {
var theme = getGiscusTheme()
/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
if (!frame) return
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
})
})
</script>
{% endif %}