From 1e709b5ba48256988de2140ffb2a84ca956b5887 Mon Sep 17 00:00:00 2001 From: Dillon ZENG Date: Fri, 2 Aug 2019 16:16:59 +0800 Subject: [PATCH] fix: fix disqus feature and format --- layouts/404.html | 26 ++++---- layouts/_default/single.html | 22 +++---- layouts/index.html | 10 +-- layouts/partials/comments.html | 111 ++++++++++++++------------------- layouts/rss.xml | 46 +++++++------- layouts/sitemap.xml | 51 +++++++-------- 6 files changed, 121 insertions(+), 145 deletions(-) diff --git a/layouts/404.html b/layouts/404.html index 56f9f929..da1ae411 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,16 +1,16 @@ {{ define "content" }} -
+

-

/* 404 {{ i18n "page" }} {{ i18n "not" }} {{ i18n "found" }}. */

- -
- +

/* 404 {{ i18n "page" }} {{ i18n "not" }} {{ i18n "found" }}. */

+ +
+ {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 71f52c6d..d9bd592c 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -37,7 +37,7 @@ {{ end }} - + {{ $reAltIn := "\"([^\"]+)?\"" }} {{ $reAltOut := ( printf "
\"$2\"
$2
" $cdn_url ) }} {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }} @@ -56,12 +56,12 @@ {{ . }}

{{ end }} - + - +
{{ with .Params.tags }}
{{ i18n "Tag" }}: {{ range . }} - - #{{.}} + + #{{.}} + {{ end }}
{{ end }}
- {{ i18n "back" }} · + {{ i18n "back" }} · {{ i18n "Home" }}
@@ -96,16 +96,16 @@
{{ if .PrevInSection }} - {{ end }} + {{ end }} {{ if .NextInSection }} {{ end }}
- {{ if ( .Params.showComments | default true ) }} - {{ partial "comments.html" . }} - {{ end }} + {{ if ( .Params.showComments | default true ) }} + {{ partial "comments" . }} + {{ end }}
{{- end }} diff --git a/layouts/index.html b/layouts/index.html index b2ffa600..167ce66b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -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 }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index d5549383..33e9f8b4 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,68 +1,51 @@ {{ if and .IsPage (ne .Params.comment false) -}} - - {{- if .Site.DisqusShortname -}} -
- - - {{- end -}} + + {{- if .Site.Params.gitalk.owner -}} +
+ + + + + {{- end }} - - {{- if .Site.Params.gitalk.owner -}} -
- - - - - {{- end }} - - {{- if .Site.Params.valine.enable -}} - - - 1000000 -

-
-
- - - - {{- end -}} + + {{- if .Site.Params.valine.enable -}} + + + 1000000 +

+
+
+ + + + {{- end -}} {{- end }} - diff --git a/layouts/rss.xml b/layouts/rss.xml index ebfb43be..0c06c992 100644 --- a/layouts/rss.xml +++ b/layouts/rss.xml @@ -1,24 +1,26 @@ - - {{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }} - {{ .Permalink }} - Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - - {{ range first 15 (where .Data.Pages "Type" "!=" "home") }} - - {{ .Title }} - {{ .Permalink }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}} - {{ .Permalink }} - {{ .Content | html }} - - {{ end }} - + + {{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }} + {{ .Permalink }} + Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + + {{ range first 15 (where .Data.Pages "Type" "!=" "home") }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }} + {{.}}{{ with site.Author.name }} ({{.}}){{end}} + {{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml index 797088f9..20c6f28b 100644 --- a/layouts/sitemap.xml +++ b/layouts/sitemap.xml @@ -1,31 +1,22 @@ - - {{ range (where .Data.Pages "Section" "!=" "gallery") }} - - {{ .Permalink }} - {{ if not .Lastmod.IsZero }} - {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }} - {{ end }} - {{ with .Sitemap.ChangeFreq }} - {{ . }} - {{ end }} - {{ if ge .Sitemap.Priority 0.0 }} - {{ .Sitemap.Priority }} - {{ end }} - {{ if .IsTranslated }} - {{ range .Translations }} - - {{ end }} - - {{ end }} - - {{ end }} + + {{ range (where .Data.Pages "Section" "!=" "gallery") }} + + {{ .Permalink }} + {{ if not .Lastmod.IsZero }} + {{ safeHTML ( .Lastmod.Format"2006-01-02T15:04:05-07:00" ) }} + {{ end }} + {{ with .Sitemap.ChangeFreq }} + {{ . }} + {{ end }} + {{ if ge .Sitemap.Priority 0.0 }} + {{ .Sitemap.Priority }} + {{ end }} + {{ if .IsTranslated }} + {{ range .Translations }} + + {{ end }} + + {{ end }} + + {{ end }}