Add post: 暗黑能天使
This commit is contained in:
5
layouts/partials/comment/commento.html
Normal file
5
layouts/partials/comment/commento.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="commento"></div>
|
||||
<script defer
|
||||
src="{{ .Site.Params.comment.commento.url | default "https://cdn.commento.io"}}/js/commento.js">
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to load the comments.</noscript>
|
||||
22
layouts/partials/comment/disqus.html
Normal file
22
layouts/partials/comment/disqus.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ if .Site.Params.comment.disqus.shortname }}
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
var disqus_config = function () {
|
||||
{{ with .Site.Params.comment.disqus.identifier }}this.page.identifier = '{{ . }}';{{ end }}
|
||||
{{ with .Site.Params.comment.disqus.title }}this.page.title = '{{ . }}';{{ end }}
|
||||
{{ with .Site.Params.comment.disqus.url }}this.page.url = '{{ . | html }}';{{ end }}
|
||||
};
|
||||
(function() {
|
||||
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
|
||||
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
|
||||
return;
|
||||
}
|
||||
var d = document, s = d.createElement('script'); s.async = true;
|
||||
s.src = '//' + {{ .Site.Params.comment.disqus.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>
|
||||
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
||||
{{ end }}
|
||||
38
layouts/partials/comment/utterances.html
Normal file
38
layouts/partials/comment/utterances.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<script id="utterances" src="https://utteranc.es/client.js"
|
||||
{{- range $key, $value := .Site.Params.comment.utterances }}
|
||||
{{- if and (eq $key "theme") (eq $value "eureka") }}
|
||||
{{- if eq $.Site.Params.colorScheme "light" }}
|
||||
{{ printf "%s=%v" $key "github-light" | safeHTMLAttr }}
|
||||
{{- else if eq $.Site.Params.colorScheme "dark" }}
|
||||
{{ printf "%s=%v" $key "github-dark" | safeHTMLAttr }}
|
||||
{{- else }}
|
||||
{{ printf "%s=%v" $key "preferred-color-scheme" | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- else if or $value (eq $value false) }}
|
||||
{{ printf "%s=%v" $key $value | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
<script>
|
||||
{{- if eq .Site.Params.colorScheme "light" }}
|
||||
if (storageColorScheme == "Auto") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-dark')
|
||||
}
|
||||
{{- else if eq .Site.Params.colorScheme "dark" }}
|
||||
if (storageColorScheme == "Auto") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
|
||||
} else if (storageColorScheme == "Light") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-light')
|
||||
}
|
||||
{{- else }}
|
||||
if (storageColorScheme == "Light") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-light')
|
||||
} else if (storageColorScheme == "Dark") {
|
||||
document.getElementById('utterances').setAttribute('theme', 'github-dark')
|
||||
}
|
||||
{{- end }}
|
||||
</script>
|
||||
14
layouts/partials/comment/valine.html
Normal file
14
layouts/partials/comment/valine.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<div id="valine-comments" class="mt-4"></div>
|
||||
{{- $assets := .Site.Data.assets }}
|
||||
<script defer src="{{ printf $assets.valine.js.url $assets.valine.version }}" {{ with $assets.valine.js.sri }}
|
||||
integrity="{{ . }}" {{ end }} crossorigin></script>
|
||||
{{- with .Site.Params.comment.valine }}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
new Valine({
|
||||
el: "#valine-comments",
|
||||
{{- partial "utils/get-js-configs" . | safeJS }}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user