mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 19:06:16 +01:00
Merge pull request #66 from dillonzq/feature/improve_comments
feat(comments): improve comments and add valine config meta
This commit is contained in:
commit
2d350af854
3 changed files with 59 additions and 61 deletions
|
@ -306,10 +306,12 @@ dateFormatToUse = "2006-01-02"
|
||||||
enable = false
|
enable = false
|
||||||
appId = ""
|
appId = ""
|
||||||
appKey = ""
|
appKey = ""
|
||||||
|
placeholder = "Your comment ..."
|
||||||
notify = false
|
notify = false
|
||||||
verify = true
|
verify = true
|
||||||
avatar = "mp"
|
avatar = "mp"
|
||||||
placeholder = "Your comment ..."
|
#meta= ""
|
||||||
|
pageSize = 10
|
||||||
visitor = true
|
visitor = true
|
||||||
recordIP = true
|
recordIP = true
|
||||||
|
|
||||||
|
|
|
@ -306,10 +306,12 @@ dateFormatToUse = "2006-01-02"
|
||||||
enable = false
|
enable = false
|
||||||
appId = ""
|
appId = ""
|
||||||
appKey = ""
|
appKey = ""
|
||||||
|
placeholder = "你的评论 ..."
|
||||||
notify = false
|
notify = false
|
||||||
verify = true
|
verify = true
|
||||||
avatar = "mp"
|
avatar = "mp"
|
||||||
placeholder = "你的评论 ..."
|
#meta= ""
|
||||||
|
pageSize = 10
|
||||||
visitor = true
|
visitor = true
|
||||||
recordIP = true
|
recordIP = true
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,14 @@
|
||||||
{{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
|
{{- if eq (getenv "HUGO_ENV") "production" | and .IsPage | and (ne .Params.comment false) -}}
|
||||||
{{- /* Disqus Comment System */ -}}
|
{{- /* Disqus Comment System */ -}}
|
||||||
{{- if .Site.Params.disqus.shortname -}}
|
{{- with .Site.Params.disqus.shortname -}}
|
||||||
<div id="disqus_thread"></div>
|
<div id="disqus_thread"></div>
|
||||||
<script type="text/javascript">
|
<script src="https://{{ . }}.disqus.com/embed.js"></script>
|
||||||
(function() {
|
|
||||||
// Don't ever inject Disqus on localhost--it creates unwanted
|
|
||||||
// discussions from "localhost" on your Disqus account...
|
|
||||||
if (window.location.hostname == "localhost")
|
|
||||||
return;
|
|
||||||
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
|
|
||||||
var disqus_shortname = "{{ .Site.Params.disqus.shortname }}";
|
|
||||||
dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
|
|
||||||
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
|
|
||||||
})();
|
|
||||||
</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 -}}
|
||||||
|
|
||||||
{{- /* Gitalk Comment System */ -}}
|
{{- /* Gitalk Comment System */ -}}
|
||||||
{{- if .Site.Params.gitalk.owner -}}
|
{{- if .Site.Params.gitalk.owner -}}
|
||||||
<div id="gitalk-container"></div>
|
<div id="gitalk_container"></div>
|
||||||
{{- if .Site.Params.cdn.gitalk_css -}}
|
{{- if .Site.Params.cdn.gitalk_css -}}
|
||||||
{{- .Site.Params.cdn.gitalk_css | safeHTML -}}
|
{{- .Site.Params.cdn.gitalk_css | safeHTML -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
@ -32,57 +21,62 @@
|
||||||
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
|
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
|
||||||
<script src="{{ $res.RelPermalink }}"></script>
|
<script src="{{ $res.RelPermalink }}"></script>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
(function () {
|
var gitalk = new Gitalk({
|
||||||
// Don't ever inject Gitalk on localhost--it creates unwanted
|
id: "{{ .Date }}",
|
||||||
// discussions from "localhost" on your Gitalk account...
|
title: "{{ .Title }}",
|
||||||
if (window.location.hostname == "localhost")
|
clientID: "{{ .Site.Params.gitalk.clientId }}",
|
||||||
return;
|
clientSecret: "{{ .Site.Params.gitalk.clientSecret }}",
|
||||||
var gitalk = new Gitalk({
|
repo: "{{ .Site.Params.gitalk.repo }}",
|
||||||
id: "{{ .Date }}",
|
owner: "{{ .Site.Params.gitalk.owner }}",
|
||||||
title: "{{ .Title }}",
|
admin: ["{{ .Site.Params.gitalk.owner }}"],
|
||||||
clientID: "{{ .Site.Params.gitalk.clientId }}",
|
body: decodeURI(location.href)
|
||||||
clientSecret: "{{ .Site.Params.gitalk.clientSecret }}",
|
});
|
||||||
repo: "{{ .Site.Params.gitalk.repo }}",
|
gitalk.render("gitalk_container");
|
||||||
owner: "{{ .Site.Params.gitalk.owner }}",
|
|
||||||
admin: ["{{ .Site.Params.gitalk.owner }}"],
|
|
||||||
body: decodeURI(location.href)
|
|
||||||
});
|
|
||||||
gitalk.render("gitalk-container");
|
|
||||||
})();
|
|
||||||
</script>
|
</script>
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by Gitalk.</a></noscript>
|
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by Gitalk.</a></noscript>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* Valine Comment System */ -}}
|
{{- /* Valine Comment System */ -}}
|
||||||
{{- if .Site.Params.valine.enable -}}
|
{{- if .Site.Params.valine.enable -}}
|
||||||
<div id="vcomments"></div>
|
<div id="valine_container"></div>
|
||||||
{{- if .Site.Params.cdn.valine_js -}}
|
{{- if .Site.Params.cdn.valine_js -}}
|
||||||
{{- .Site.Params.cdn.valine_js | safeHTML -}}
|
{{- .Site.Params.cdn.valine_js | safeHTML -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
|
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
|
||||||
<script src="{{ $res.RelPermalink }}"></script>
|
<script src="{{ $res.RelPermalink }}"></script>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
<script type="text/javascript">
|
<script>
|
||||||
(function () {
|
new Valine({
|
||||||
// Don't ever inject Valine on localhost--it creates unwanted
|
el: "#valine_container",
|
||||||
// discussions from "localhost" on your Valine account...
|
appId: "{{ .Site.Params.valine.appId }}",
|
||||||
if (window.location.hostname == "localhost")
|
appKey: "{{ .Site.Params.valine.appKey }}",
|
||||||
return;
|
{{- with .Site.Params.valine.placeholder -}}
|
||||||
new Valine({
|
placeholder: "{{ . }}",
|
||||||
el: "#vcomments",
|
{{- end -}}
|
||||||
appId: "{{ .Site.Params.valine.appId }}",
|
{{- if .Site.Params.valine.notify -}}
|
||||||
appKey: "{{ .Site.Params.valine.appKey }}",
|
notify: true,
|
||||||
meta: ["nick", "mail"],
|
{{- end -}}
|
||||||
notify: "{{ .Site.Params.valine.notify }}",
|
{{- if .Site.Params.valine.verify -}}
|
||||||
verify: "{{ .Site.Params.valine.verify }}",
|
verify: true,
|
||||||
avatar: "{{ .Site.Params.valine.avatar }}",
|
{{- end -}}
|
||||||
placeholder: "{{ .Site.Params.valine.placeholder }}",
|
{{- with .Site.Params.valine.avatar -}}
|
||||||
visitor: "{{ .Site.Params.valine.visitor }}",
|
avatar: "{{ . }}",
|
||||||
recordIP: "{{ .Site.Params.valine.recordIP }}",
|
{{- end -}}
|
||||||
lang: "{{ T `valineLang` }}",
|
{{- with .Site.Params.valine.meta -}}
|
||||||
});
|
meta: {{ . | safeJS }},
|
||||||
})();
|
{{- end -}}
|
||||||
|
{{- with .Site.Params.valine.pageSize -}}
|
||||||
|
pageSize: {{ . | safeJS }},
|
||||||
|
{{- end -}}
|
||||||
|
lang: {{ T "valineLang" }},
|
||||||
|
{{- if .Site.Params.valine.visitor -}}
|
||||||
|
visitor: true,
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Site.Params.valine.recordIP -}}
|
||||||
|
recordIP: true,
|
||||||
|
{{- end -}}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://valine.js.org/">comments powered by Valine.</a></noscript>
|
<noscript>Please enable JavaScript to view the <a href="https://valine.js.org/">comments powered by Valine.</a></noscript>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -90,18 +84,18 @@
|
||||||
{{- /* Facebook Comment System */ -}}
|
{{- /* Facebook Comment System */ -}}
|
||||||
{{- if .Site.Params.facebook.enable -}}
|
{{- if .Site.Params.facebook.enable -}}
|
||||||
<div id="fb-root"></div>
|
<div id="fb-root"></div>
|
||||||
<script
|
|
||||||
async
|
|
||||||
defer
|
|
||||||
crossorigin="anonymous"
|
|
||||||
src="https://connect.facebook.net/{{ .Site.Params.facebook.languageCode }}/sdk.js#xfbml=1&version=v5.0&appId={{ .Site.Params.facebook.appId }}&autoLogAppEvents=1"
|
|
||||||
></script>
|
|
||||||
<div
|
<div
|
||||||
class="fb-comments"
|
class="fb-comments"
|
||||||
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
|
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
|
||||||
data-width="{{ .Site.Params.facebook.width }}"
|
data-width="{{ .Site.Params.facebook.width }}"
|
||||||
data-numposts="{{ .Site.Params.facebook.numPosts }}"
|
data-numposts="{{ .Site.Params.facebook.numPosts }}"
|
||||||
></div>
|
></div>
|
||||||
|
<script
|
||||||
|
async
|
||||||
|
defer
|
||||||
|
crossorigin="anonymous"
|
||||||
|
src="https://connect.facebook.net/{{ .Site.Params.facebook.languageCode }}/sdk.js#xfbml=1&version=v5.0&appId={{ .Site.Params.facebook.appId }}&autoLogAppEvents=1"
|
||||||
|
></script>
|
||||||
<noscript>Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a></noscript>
|
<noscript>Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a></noscript>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in a new issue