Various Fix and added support for Hugo 0.55

This commit is contained in:
Giuseppe Pignataro
2019-05-05 10:25:43 +02:00
parent 8b49c5eaa2
commit fc248e808b
8 changed files with 62 additions and 14 deletions

View File

@@ -21,6 +21,34 @@
<article class="archive-item"> <article class="archive-item">
<a href="{{ .URL }}" class="archive-item-link">{{ .Title }}</a> <a href="{{ .URL }}" class="archive-item-link">{{ .Title }}</a>
</article> </article>
{{ end }}
{{ if gt (len $pages) 5 }}
<span class="more-post">
<a href="{{ .Permalink }}" class="more-post-link">{{ i18n "More" }} >></a>
</span>
{{ end }}{{ define "content" }}
{{ $termName := .Data.Plural }}
{{ $terms := .Data.Terms.ByCount }}
{{ $length := len $terms }}
{{ $type := .Type }}
<!-- Categories Page -->
<div class="post-warp {{.Data.Plural}}">
<h2 class="post-title" style="text-align:right;padding-bottom:2em">-&nbsp;{{ .Data.Plural | humanize }}&nbsp;-</h2>
{{ if and $.Site.Taxonomies.categories (eq $termName "categories") }}
<div class="categories-card">
{{ range $terms }}
{{ $term := .Term }}
{{ $pages := .Pages }}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }}
<div class="card-item">
<div class="categories" >
<a href="{{ .Permalink }}"><h3> <i class="iconfont icon-folder" style="padding-right: 3px"></i> {{ $term | humanize}} </h3> </a>
{{ range first 5 $pages }}
<article class="archive-item">
<a href="{{ .Permalink }}" class="archive-item-link">{{ .Title }}</a>
</article>
{{ end }} {{ end }}
{{ if gt (len $pages) 5 }} {{ if gt (len $pages) 5 }}
<span class="more-post"> <span class="more-post">
@@ -42,6 +70,24 @@
{{end}} {{end}}
</div> </div>
{{ end }}
</div>
{{end }}
</div>
</div>
{{ end }}
{{ end }}
</div> <!-- //categories-card -->
<!-- Tag cloud Page -->
{{ else if and $.Site.Taxonomies.tags (eq $termName "tags") }}
<div class="tag-cloud-tags">
{{ range $.Site.Taxonomies.tags.ByCount }}
{{ if .Name }}
<a href="/tags/{{ .Name | urlize}}/"> {{ .Name }} <small>({{ .Count }})</small></a>
{{ end }}
{{end}}
</div>
{{ end }} {{ end }}
</div> </div>
{{end }} {{end }}

View File

@@ -40,7 +40,7 @@
<!-- valine --> <!-- valine -->
{{- if .Site.Params.valine.enable -}} {{- if .Site.Params.valine.enable -}}
<span <span
id="{{ .URL | relURL }}" id="{{ .RelPermalink | relURL }}"
class="leancloud_visitors" class="leancloud_visitors"
data-flag-title="{{ .Title }}" data-flag-title="{{ .Title }}"
> >
@@ -65,3 +65,4 @@
</script> </script>
{{- end -}} {{- end -}}
{{- end }} {{- end }}

View File

@@ -31,9 +31,9 @@
</title> </title>
<meta name="title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end}}"> <meta name="title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end}}">
{{ partial "css" . }} {{ partial "css" . }}
{{ if .RSSLink }} {{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}">
<link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> <link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}">
{{ end }} {{ end }}
{{- template "_internal/twitter_cards.html" . }} {{- template "_internal/twitter_cards.html" . }}
{{ partial "seo_schema" . }} {{ partial "seo_schema" . }}
@@ -45,3 +45,4 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ .Scratch.Set "cdn_url" $cdn_url }} {{ .Scratch.Set "cdn_url" $cdn_url }}

View File

@@ -58,7 +58,7 @@
{{ with .Params.tags }} {{ with .Params.tags }}
<div class="post-tags"> <div class="post-tags">
{{ range . }} {{ range . }}
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/">
#{{.}}</a></span> #{{.}}</a></span>
{{ end }} {{ end }}
</div> </div>

View File

@@ -5,17 +5,17 @@
<description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description> <description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{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 }} <webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<atom:link href="{{.URL}}" rel="self" type="application/rss+xml" /> <atom:link href="{{.Permalink}}" rel="self" type="application/rss+xml" />
{{ range first 15 (where .Data.Pages "Type" "!=" "home") }} {{ range first 15 (where .Data.Pages "Type" "!=" "home") }}
<item> <item>
<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>