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

@ -12,5 +12,5 @@
];
var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)];
errorEmojiContainer.appendChild(document.createTextNode(errorEmoji));
</script>
</script>
{{ end }}

View file

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

View file

@ -1,20 +1,7 @@
{{ if and .IsPage (ne .Params.comment false) -}}
<!-- Disqus Comment System-->
{{- if .Site.DisqusShortname -}}
<div id="disqus_thread"></div>
<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>
{{ template "_internal/disqus.html" . }}
{{- end -}}
<!-- gitalk Comment System-->
@ -37,13 +24,10 @@
</script>
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript>
{{- end }}
<!-- valine -->
{{- if .Site.Params.valine.enable -}}
<span
id="{{ .RelPermalink | relURL }}"
class="leancloud_visitors"
data-flag-title="{{ .Title }}"
>
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
<span class="post-meta-item-text"> pm </span>
<span class="leancloud-visitors-count">1000000</span>
<p></p>
@ -65,4 +49,3 @@
</script>
{{- end -}}
{{- end }}

View file

@ -15,7 +15,9 @@
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<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>
<description>{{ .Content | html }}</description>
</item>

View file

@ -1,10 +1,9 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range (where .Data.Pages "Section" "!=" "gallery") }}
<url>
<loc>{{ .Permalink }}</loc>
{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>
<lastmod>{{ safeHTML ( .Lastmod.Format"2006-01-02T15:04:05-07:00" ) }}</lastmod>
{{ end }}
{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>
@ -14,17 +13,9 @@
{{ end }}
{{ if .IsTranslated }}
{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
<xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>
<xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
{{ end }}
</url>
{{ end }}