Skip to content

Commit ed69e35

Browse files
authored
chore: update comment system (doocs#2499)
1 parent 6ad0803 commit ed69e35

File tree

8 files changed

+135
-3
lines changed

8 files changed

+135
-3
lines changed

docs-en/assets/images/hero.jpg

767 KB
Loading

docs-en/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
comments: true
3-
template: index.html
3+
# template: en/index.html
44
hide:
55
- navigation
66
- toc

docs/assets/images/hero.jpg

767 KB
Loading

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
comments: true
3-
template: index.html
3+
# template: index.html
44
hide:
55
- navigation
66
- toc

docs/lc/1.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
comments: true
3+
---
4+
5+
6+
17
# [1. 两数之和](https://leetcode.cn/problems/two-sum)
28

39

overrides/en/index.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{% extends "base.html" %}
2+
3+
<!-- Render hero under tabs -->
4+
{% block tabs %}
5+
{{ super() }}
6+
7+
<!-- Additional styles for landing page -->
8+
<style>
9+
/* Application header should be static for the landing page */
10+
.md-header {
11+
position: initial;
12+
}
13+
14+
/* Remove spacing, as we cannot hide it completely */
15+
.md-main__inner {
16+
margin: 0;
17+
}
18+
19+
/* Hide table of contents */
20+
@media screen and (min-width: 60em) {
21+
.md-sidebar--secondary {
22+
display: none;
23+
}
24+
}
25+
26+
/* Hide navigation */
27+
@media screen and (min-width: 76.25em) {
28+
.md-sidebar--primary {
29+
display: none;
30+
}
31+
}
32+
</style>
33+
34+
<section class="mdx-container">
35+
<div class="md-grid md-typeset">
36+
<div class="mdx-hero">
37+
38+
<!-- Hero image -->
39+
<div class="mdx-hero__image">
40+
<img src="assets/images/hero.jpg" alt="" width="1659" height="1200" draggable="false">
41+
</div>
42+
43+
<!-- Hero content -->
44+
<div class="mdx-hero__content">
45+
<h1>LeetCode Wiki</h1>
46+
<p>{{ config.site_description }}</p>
47+
<a href="{{ page.next_page.url | url }}" title="{{ page.next_page.title | e }}"
48+
class="md-button md-button--primary">
49+
Get Started
50+
</a>
51+
</div>
52+
53+
<!-- Comments system -->
54+
{% include "partials/comments.html" %}
55+
</div>
56+
</div>
57+
58+
</section>
59+
{% endblock %}
60+
61+
{% block content %} {% endblock %}

overrides/index.html

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,61 @@
1-
{% extends "base.html" %}
1+
{% extends "base.html" %}
2+
3+
<!-- Render hero under tabs -->
4+
{% block tabs %}
5+
{{ super() }}
6+
7+
<!-- Additional styles for landing page -->
8+
<style>
9+
/* Application header should be static for the landing page */
10+
.md-header {
11+
position: initial;
12+
}
13+
14+
/* Remove spacing, as we cannot hide it completely */
15+
.md-main__inner {
16+
margin: 0;
17+
}
18+
19+
/* Hide table of contents */
20+
@media screen and (min-width: 60em) {
21+
.md-sidebar--secondary {
22+
display: none;
23+
}
24+
}
25+
26+
/* Hide navigation */
27+
@media screen and (min-width: 76.25em) {
28+
.md-sidebar--primary {
29+
display: none;
30+
}
31+
}
32+
</style>
33+
34+
<section class="mdx-container">
35+
<div class="md-grid md-typeset">
36+
<div class="mdx-hero">
37+
38+
<!-- Hero image -->
39+
<div class="mdx-hero__image">
40+
<img src="assets/images/hero.jpg" alt="" width="1659" height="1200" draggable="false">
41+
</div>
42+
43+
<!-- Hero content -->
44+
<div class="mdx-hero__content">
45+
<h1>LeetCode Wiki</h1>
46+
<p>{{ config.site_description }}</p>
47+
<a href="{{ page.next_page.url | url }}" title="{{ page.next_page.title | e }}"
48+
class="md-button md-button--primary">
49+
开始学习
50+
</a>
51+
</div>
52+
53+
<!-- Comments system -->
54+
{% include "partials/comments.html" %}
55+
</div>
56+
</div>
57+
58+
</section>
59+
{% endblock %}
60+
61+
{% block content %} {% endblock %}

overrides/partials/comments.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ <h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
2020
<script>
2121
var giscus = document.querySelector("script[src*=giscus]")
2222

23+
/* Set language on initial load */
24+
var lang = document.querySelector("html").lang
25+
const dataLang = lang === "en" ? "en" : "zh-CN"
26+
giscus.setAttribute("data-lang", dataLang)
27+
2328
/* Set palette on initial load */
2429
var palette = __md_get("__palette")
2530
if (palette && typeof palette.color === "object") {

0 commit comments

Comments
 (0)