fix: fix disqus feature and format

This commit is contained in:
Dillon ZENG
2019-08-02 16:16:59 +08:00
parent 3e2972c318
commit 1e709b5ba4
6 changed files with 121 additions and 145 deletions

View File

@@ -76,14 +76,14 @@
{{ end }} {{ end }}
</div> </div>
<div class="post-tags"> <div class="post-tags">
{{ with .Params.tags }} {{ with .Params.tags }}
<section> <section>
<i class="iconfont icon-icon-tag"></i>{{ i18n "Tag" }}: <i class="iconfont icon-icon-tag"></i>{{ i18n "Tag" }}:
{{ range . }} {{ range . }}
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> <span class="tag">
#{{.}}</a></span> <a href="{{ "tags/" | absURL }}{{ . | urlize }}/">#{{.}}</a>
</span>
{{ end }} {{ end }}
</section> </section>
{{ end }} {{ end }}
@@ -104,7 +104,7 @@
<div class="post-comment"> <div class="post-comment">
{{ if ( .Params.showComments | default true ) }} {{ if ( .Params.showComments | default true ) }}
{{ partial "comments.html" . }} {{ partial "comments" . }}
{{ end }} {{ end }}
</div> </div>
</article> </article>

View File

@@ -1,20 +1,7 @@
{{ if and .IsPage (ne .Params.comment false) -}} {{ if and .IsPage (ne .Params.comment false) -}}
<!-- Disqus Comment System--> <!-- Disqus Comment System-->
{{- if .Site.DisqusShortname -}} {{- if .Site.DisqusShortname -}}
<div id="disqus_thread"></div> {{ template "_internal/disqus.html" . }}
<script type="text/javascript">
(function() {
// Don't ever inject Disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' 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.DisqusShortname }}';
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="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
{{- end -}} {{- end -}}
<!-- gitalk Comment System--> <!-- gitalk Comment System-->
@@ -37,13 +24,10 @@
</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 --> <!-- valine -->
{{- if .Site.Params.valine.enable -}} {{- if .Site.Params.valine.enable -}}
<span <span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
id="{{ .RelPermalink | relURL }}"
class="leancloud_visitors"
data-flag-title="{{ .Title }}"
>
<span class="post-meta-item-text"> pm </span> <span class="post-meta-item-text"> pm </span>
<span class="leancloud-visitors-count">1000000</span> <span class="leancloud-visitors-count">1000000</span>
<p></p> <p></p>
@@ -65,4 +49,3 @@
</script> </script>
{{- end -}} {{- end -}}
{{- end }} {{- end }}

View File

@@ -15,7 +15,9 @@
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}} {{ with .Site.Author.email }}
<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>
{{end}}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description> <description>{{ .Content | html }}</description>
</item> </item>

View File

@@ -1,5 +1,4 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range (where .Data.Pages "Section" "!=" "gallery") }} {{ range (where .Data.Pages "Section" "!=" "gallery") }}
<url> <url>
<loc>{{ .Permalink }}</loc> <loc>{{ .Permalink }}</loc>
@@ -14,17 +13,9 @@
{{ end }} {{ end }}
{{ if .IsTranslated }} {{ if .IsTranslated }}
{{ range .Translations }} {{ range .Translations }}
<xhtml:link <xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
{{ end }} {{ end }}
<xhtml:link <xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
{{ end }} {{ end }}
</url> </url>
{{ end }} {{ end }}