-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package comments | ||
|
||
type Valine struct { | ||
Enabled bool `toml:"enabled"` | ||
APPID string `toml:"app_id"` | ||
APPKey string `toml:"app_key"` | ||
ServerURL string `toml:"server_url"` | ||
} | ||
|
||
func defaultValine() *Valine { | ||
return &Valine{ | ||
Enabled: false, | ||
APPID: "", | ||
APPKey: "", | ||
ServerURL: "", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,43 @@ | ||
{{if .server.Local}} | ||
<p class="comment-local-disabled">Comment is disabled in local server.</p> | ||
{{if not .server.Local}} | ||
<p class="comment-local-disabled">Comment is disabled in local server.</p> | ||
{{else}} | ||
|
||
{{- with .extension.Comments.Disqus}} | ||
{{- if .Enabled}} | ||
<div id="disqus_thread"></div> | ||
<script> | ||
(function() { // DON'T EDIT BELOW THIS LINE | ||
var d = document, s = d.createElement('script'); | ||
s.src = 'https://{{.Shortname}}.disqus.com/embed.js'; | ||
s.setAttribute('data-timestamp', +new Date()); | ||
(d.head || d.body).appendChild(s); | ||
(function () { // DON'T EDIT BELOW THIS LINE | ||
var d = document, | ||
s = d.createElement('script'); | ||
s.src = 'https://{{.Shortname}}.disqus.com/embed.js'; | ||
s.setAttribute('data-timestamp', +new Date()); | ||
(d.head || d.body).appendChild(s); | ||
})(); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by | ||
Disqus.</a></noscript> | ||
{{end -}} | ||
{{end -}} | ||
|
||
{{- with .extension.Comments.Valine}} | ||
{{- if .Enabled}} | ||
<div id="vcomments"></div> | ||
<script src="https://unpkg.com/valine@latest/dist/Valine.min.js"></script> | ||
<script defer> | ||
new Valine({ | ||
el: '#vcomments', | ||
appId: '{{.APPID}}', | ||
appKey: '{{.APPKey}}', | ||
serverURLs: '{{.ServerURL}}', | ||
avatar: 'mp', | ||
placeholder: 'Leave a comment', | ||
pageSize: 10, | ||
visitor: false, | ||
recordIP: false, | ||
requiredFields: ['nick', 'mail'], | ||
}) | ||
</script> | ||
{{end -}} | ||
{{end -}} | ||
|
||
{{end}} | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.