File tree 3 files changed +173
-0
lines changed
3 files changed +173
-0
lines changed Original file line number Diff line number Diff line change
1
+ < form method ="POST " action ="{{ site.comments.staticman_url }} " class ="comment-form ">
2
+ < input name ="options[redirect] " type ="hidden " value ="{{ 'comment-success' | absolute_url }} ">
3
+ < input name ="options[redirectError] " type ="hidden " value ="{{ 'comment-error' | absolute_url }} ">
4
+ < input name ="options[slug] " type ="hidden " value ="{{ page.slug }} " />
5
+ < input name ="fields[parent_id] " type ="hidden " value ="{{ include.parent_id }} " />
6
+
7
+ < input type ="hidden " name ="options[reCaptcha][siteKey] " value ="6LdnV_opAAAAAN5iGmTD_oQ0Vc5khmshh4AbGDbk ">
8
+ < input type ="hidden " name ="options[reCaptcha][secret] " value ="6LdnV_opAAAAAEIxadkcyztVjMEc5x64VPIWx6Mj ">
9
+
10
+ < input
11
+ class ="comment-name "
12
+ name ="fields[name] "
13
+ type ="text "
14
+ placeholder ="Name "
15
+ required
16
+ />
17
+
18
+ < textarea
19
+ id ="message-{{ include.parent_id }} "
20
+ class ="comment-message "
21
+ name ="fields[message] "
22
+ placeholder ="Comment (markdown accepted) "
23
+ required
24
+ > </ textarea >
25
+
26
+ < div
27
+ class ="g-recaptcha "
28
+ data-sitekey ="6LdnV_opAAAAAN5iGmTD_oQ0Vc5khmshh4AbGDbk "
29
+ > </ div >
30
+
31
+ < button class ="comment-submit " >
32
+ SEND
33
+ </ button >
34
+ </ form >
35
+
36
+ < script >
37
+ var simplemde = new SimpleMDE ( {
38
+ element : document . getElementById ( "message-{{ include.parent_id }}" ) ,
39
+ forceSync : true ,
40
+ spellChecker : false ,
41
+ status : false ,
42
+ placeholder : "Comment (markdown supported)" ,
43
+ } ) ;
44
+ </ script >
Original file line number Diff line number Diff line change
1
+ {% assign parent_id = include.parent_id | default: '' %}
2
+ {% assign comments = site.data.comments[page.slug] | where_exp: "item", "item.parent_id == parent_id" %}
3
+ {% assign sorted_comments = comments | sort: 'date' %}
4
+ {% for comment in sorted_comments %}
5
+ < div class ="comment ">
6
+ < h3 > {{comment.name}}</ h3 >
7
+ < time
8
+ class ="post-meta dt-published "
9
+ datetime ="{{ page.date | date_to_xmlschema }} "
10
+ itemprop ="datePublished "
11
+ >
12
+ {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
13
+ {{ comment.date | date:" %H:%M - %b %-d, %Y" }}
14
+ </ time >
15
+ < p > {{comment.message | strip_html | markdownify }}</ p >
16
+ < div class ="comment-reply ">
17
+ < input id ="reply-{{ comment._id}} " type ="checkbox " class ="checkbox " />
18
+ < label class ="open " for ="reply-{{ comment._id }} ">
19
+ Reply to {{ comment.name }}
20
+ </ label >
21
+ < label class ="close " for ="reply-{{ comment._id }} "> X</ label >
22
+ {% include my-comment-form.html parent_id=comment._id %}
23
+ {% include my-comment-list.html parent_id=comment._id %}
24
+ </ div >
25
+ </ div >
26
+ {% endfor %}
Original file line number Diff line number Diff line change
1
+ // _sass/comments.scss
2
+ .comment {
3
+ padding-top : 10px ;
4
+ h3 {
5
+ display : inline ;
6
+ color : royalblue ;
7
+ }
8
+ p {
9
+ margin : 0 ;
10
+ }
11
+ }
12
+
13
+ .comment-new {
14
+ margin-top : 25px ;
15
+ }
16
+
17
+ .comment-form {
18
+ display : flex ;
19
+ flex-direction : column ;
20
+ margin-top : 25px ;
21
+
22
+ .comment-message ,
23
+ .comment-name {
24
+ font-size : 16px ;
25
+ padding : 15px ;
26
+ border : 1px solid #ddd ;
27
+ margin : 0 ;
28
+ }
29
+
30
+ .comment-message {
31
+ min-height : 150px ;
32
+ resize : none ;
33
+ }
34
+
35
+ .comment-bottom {
36
+ display : flex ;
37
+ }
38
+
39
+ .comment-name {
40
+ flex : 1 ;
41
+ }
42
+
43
+ .comment-submit {
44
+ width : 200px ;
45
+ border : 1px solid #ddd ;
46
+ color : royalblue ;
47
+ font-weight : bold ;
48
+
49
+ & :hover {
50
+ cursor : pointer ;
51
+ }
52
+ }
53
+ }
54
+
55
+ .comment-reply {
56
+ padding : 15px ;
57
+ padding-top : 5px ;
58
+ display : flex ;
59
+ flex-direction : column ;
60
+
61
+ .open {
62
+ font-style : italic ;
63
+ }
64
+
65
+ .close {
66
+ display : none ;
67
+ align-self : flex-end ;
68
+ padding : 5px 10px ;
69
+ border : 1px solid #ddd ;
70
+ }
71
+
72
+ .open :hover ,
73
+ .close :hover {
74
+ cursor : pointer ;
75
+ }
76
+
77
+ .comment-form {
78
+ display : none ;
79
+ }
80
+
81
+ .checkbox {
82
+ display : none ;
83
+ & :checked ~ .open {
84
+ display : none ;
85
+ }
86
+ & :checked ~ .close {
87
+ display : block ;
88
+ }
89
+ & :checked ~ .comment-form {
90
+ display : flex ;
91
+ }
92
+ }
93
+ }
94
+
95
+ .CodeMirror ,
96
+ .editor-toolbar {
97
+ border-radius : 0 ;
98
+ }
99
+
100
+ .CodeMirror ,
101
+ .CodeMirror-scroll {
102
+ min-height : 150px ;
103
+ }
You can’t perform that action at this time.
0 commit comments