mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-13 02:16:19 +01:00
fix: fix disqus feature and format
This commit is contained in:
parent
3e2972c318
commit
1e709b5ba4
6 changed files with 121 additions and 145 deletions
|
@ -1,16 +1,16 @@
|
|||
{{ define "content" }}
|
||||
<div class="notfound">
|
||||
<div class="notfound">
|
||||
<h1 class="error-emoji"></h1>
|
||||
<p class="error-text">/* 404 {{ i18n "page" }} {{ i18n "not" }} {{ i18n "found" }}. */</p>
|
||||
<p class="error-link"><a href="{{ .Site.BaseURL }}">↑ {{ i18n "back" }} {{ i18n "to" }} {{ i18n "Home" }} ↑</a></p>
|
||||
</div>
|
||||
<script>
|
||||
var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0];
|
||||
var emojiArray = [
|
||||
'\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)',
|
||||
'(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/',
|
||||
];
|
||||
var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)];
|
||||
errorEmojiContainer.appendChild(document.createTextNode(errorEmoji));
|
||||
</script>
|
||||
<p class="error-text">/* 404 {{ i18n "page" }} {{ i18n "not" }} {{ i18n "found" }}. */</p>
|
||||
<p class="error-link"><a href="{{ .Site.BaseURL }}">↑ {{ i18n "back" }} {{ i18n "to" }} {{ i18n "Home" }} ↑</a></p>
|
||||
</div>
|
||||
<script>
|
||||
var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0];
|
||||
var emojiArray = [
|
||||
'\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)',
|
||||
'(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/',
|
||||
];
|
||||
var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)];
|
||||
errorEmojiContainer.appendChild(document.createTextNode(errorEmoji));
|
||||
</script>
|
||||
{{ end }}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image">
|
||||
{{ end }}
|
||||
<!-- end featured_image-->
|
||||
|
||||
|
||||
{{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }}
|
||||
{{ $reAltOut := ( printf "<figure><img src=\"/images/ring.svg\" data-sizes=\"auto\" data-src=\"%s$1\" alt=\"$2\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }}
|
||||
{{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }}
|
||||
|
@ -56,12 +56,12 @@
|
|||
<span>{{ . }} </span>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<p class="copyright-item">
|
||||
<span>{{ i18n "Words" }}:</span>
|
||||
<span>{{ .WordCount }}</span>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="copyright-item">
|
||||
{{ if and ( $.Param "socialShare" ) (gt (len ($.Param "share")) 0) }}
|
||||
<span>{{ i18n "Share" }}:</span>
|
||||
|
@ -76,19 +76,19 @@
|
|||
{{ 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 }}
|
||||
<section>
|
||||
<a href="javascript:window.history.back();">{{ i18n "back" }}</a></span> ·
|
||||
<a href="javascript:window.history.back();">{{ i18n "back" }}</a></span> ·
|
||||
<span><a href="{{ .Site.BaseURL }}">{{ i18n "Home" }}</a></span>
|
||||
</section>
|
||||
</div>
|
||||
|
@ -96,16 +96,16 @@
|
|||
<div class="post-nav">
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="iconfont icon-dajiantou"></i> {{ .PrevInSection.Title}}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="iconfont icon-xiaojiantou"></i></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="post-comment">
|
||||
{{ if ( .Params.showComments | default true ) }}
|
||||
{{ partial "comments.html" . }}
|
||||
{{ end }}
|
||||
{{ if ( .Params.showComments | default true ) }}
|
||||
{{ partial "comments" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</article>
|
||||
{{- end }}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{ define "content" }}
|
||||
{{ if eq .Site.Params.home_mode "post" }}
|
||||
{{ partial "home_post.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "home_profile.html" . }}
|
||||
{{ end }}
|
||||
{{ if eq .Site.Params.home_mode "post" }}
|
||||
{{ partial "home_post.html" . }}
|
||||
{{ else }}
|
||||
{{ partial "home_profile.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,68 +1,51 @@
|
|||
{{ 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;
|
||||
<!-- Disqus Comment System-->
|
||||
{{- if .Site.DisqusShortname -}}
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
{{- end -}}
|
||||
|
||||
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 -}}
|
||||
<!-- gitalk Comment System-->
|
||||
{{- if .Site.Params.gitalk.owner -}}
|
||||
<div id="gitalk-container"></div>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript">
|
||||
var gitalk = new Gitalk({
|
||||
id: '{{ .Date }}',
|
||||
title: '{{ .Title }}',
|
||||
clientID: '{{ .Site.Params.gitalk.clientId }}',
|
||||
clientSecret: '{{ .Site.Params.gitalk.clientSecret }}',
|
||||
repo: '{{ .Site.Params.gitalk.repo }}',
|
||||
owner: '{{ .Site.Params.gitalk.owner }}',
|
||||
admin: ['{{ .Site.Params.gitalk.owner }}'],
|
||||
body: decodeURI(location.href)
|
||||
});
|
||||
gitalk.render('gitalk-container');
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript>
|
||||
{{- end }}
|
||||
|
||||
<!-- gitalk Comment System-->
|
||||
{{- if .Site.Params.gitalk.owner -}}
|
||||
<div id="gitalk-container"></div>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript">
|
||||
var gitalk = new Gitalk({
|
||||
id: '{{ .Date }}',
|
||||
title: '{{ .Title }}',
|
||||
clientID: '{{ .Site.Params.gitalk.clientId }}',
|
||||
clientSecret: '{{ .Site.Params.gitalk.clientSecret }}',
|
||||
repo: '{{ .Site.Params.gitalk.repo }}',
|
||||
owner: '{{ .Site.Params.gitalk.owner }}',
|
||||
admin: ['{{ .Site.Params.gitalk.owner }}'],
|
||||
body: decodeURI(location.href)
|
||||
});
|
||||
gitalk.render('gitalk-container');
|
||||
</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 class="post-meta-item-text"> pm </span>
|
||||
<span class="leancloud-visitors-count">1000000</span>
|
||||
<p></p>
|
||||
</span>
|
||||
<div id="vcomments"></div>
|
||||
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
|
||||
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
new Valine({
|
||||
el: '#vcomments',
|
||||
appId: '{{ .Site.Params.valine.appId }}',
|
||||
appKey: '{{ .Site.Params.valine.appKey }}',
|
||||
notify: '{{ .Site.Params.valine.notify }}',
|
||||
verify: '{{ .Site.Params.valine.verify }}',
|
||||
avatar: '{{ .Site.Params.valine.avatar }}',
|
||||
placeholder: '{{ .Site.Params.valine.placeholder }}',
|
||||
visitor: '{{ .Site.Params.valine.visitor }}',
|
||||
});
|
||||
</script>
|
||||
{{- end -}}
|
||||
<!-- valine -->
|
||||
{{- if .Site.Params.valine.enable -}}
|
||||
<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>
|
||||
</span>
|
||||
<div id="vcomments"></div>
|
||||
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
|
||||
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
new Valine({
|
||||
el: '#vcomments',
|
||||
appId: '{{ .Site.Params.valine.appId }}',
|
||||
appKey: '{{ .Site.Params.valine.appKey }}',
|
||||
notify: '{{ .Site.Params.valine.notify }}',
|
||||
verify: '{{ .Site.Params.valine.verify }}',
|
||||
avatar: '{{ .Site.Params.valine.avatar }}',
|
||||
placeholder: '{{ .Site.Params.valine.placeholder }}',
|
||||
visitor: '{{ .Site.Params.valine.visitor }}',
|
||||
});
|
||||
</script>
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
<atom:link href="{{.Permalink}}" rel="self" type="application/rss+xml" />
|
||||
{{ range first 15 (where .Data.Pages "Type" "!=" "home") }}
|
||||
<item>
|
||||
<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}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Content | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
<channel>
|
||||
<title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
<atom:link href="{{.Permalink}}" rel="self" type="application/rss+xml" />
|
||||
{{ range first 15 (where .Data.Pages "Type" "!=" "home") }}
|
||||
<item>
|
||||
<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}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Content | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
|
|
|
@ -1,31 +1,22 @@
|
|||
<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>
|
||||
{{ end }}
|
||||
{{ with .Sitemap.ChangeFreq }}
|
||||
<changefreq>{{ . }}</changefreq>
|
||||
{{ end }}
|
||||
{{ if ge .Sitemap.Priority 0.0 }}
|
||||
<priority>{{ .Sitemap.Priority }}</priority>
|
||||
{{ end }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .Translations }}
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="{{ .Lang }}"
|
||||
href="{{ .Permalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
<xhtml:link
|
||||
rel="alternate"
|
||||
hreflang="{{ .Lang }}"
|
||||
href="{{ .Permalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
</url>
|
||||
{{ end }}
|
||||
<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>
|
||||
{{ end }}
|
||||
{{ with .Sitemap.ChangeFreq }}
|
||||
<changefreq>{{ . }}</changefreq>
|
||||
{{ end }}
|
||||
{{ if ge .Sitemap.Priority 0.0 }}
|
||||
<priority>{{ .Sitemap.Priority }}</priority>
|
||||
{{ end }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ range .Translations }}
|
||||
<xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
|
||||
{{ end }}
|
||||
<xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"/>
|
||||
{{ end }}
|
||||
</url>
|
||||
{{ end }}
|
||||
</urlset>
|
||||
|
|
Loading…
Reference in a new issue