rename some image variables; rss default show content

This commit is contained in:
Reorx 2022-05-08 01:24:38 +08:00
parent 4f722e0c6d
commit 0d2d905e3b
4 changed files with 15 additions and 15 deletions

View File

@ -16,10 +16,10 @@
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title> <title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description> <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ site.Title }}</description>
{{- with site.Params.images }} {{- with site.Params.logo }}
<image> <image>
<url>{{ index . 0 | absURL }}</url> <url>{{ .icon | absURL }}</url>
<link>{{ index . 0 | absURL }}</link> <link>{{ .icon | absURL }}</link>
</image> </image>
{{- end }} {{- end }}
<generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }}
@ -40,7 +40,7 @@
{{ 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>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }} {{- if not site.Params.RSSNoContent}}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- end }} {{- end }}
</item> </item>

View File

@ -60,7 +60,7 @@
{{- end }} {{- end }}
{{- /* Favicons */}} {{- /* Favicons */}}
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}"> <link rel="icon" href="{{ site.Params.favicon | default "favicon.ico" | absURL }}">
{{- /* RSS */}} {{- /* RSS */}}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}

View File

@ -42,11 +42,11 @@
<header class="header"> <header class="header">
<nav class="nav"> <nav class="nav">
<div class="logo"> <div class="logo">
{{- $label_text := (site.Params.label.text | default site.Title) }} {{- $label_text := (site.Params.logo.text | default site.Title) }}
{{- if site.Title }} {{- if site.Title }}
<a href="{{ "" | absURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)"> <a href="{{ "" | absURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)">
{{- if site.Params.label.icon }} {{- if site.Params.logo.icon }}
{{- $img := resources.Get site.Params.label.icon }} {{- $img := resources.Get site.Params.logo.icon }}
{{- if $img }} {{- if $img }}
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}}
{{- if hugo.IsExtended -}} {{- if hugo.IsExtended -}}
@ -54,17 +54,17 @@
{{- end -}} {{- end -}}
{{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }} {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
{{- if and (in $processableFormats $img.MediaType.SubType) (eq $prod true)}} {{- if and (in $processableFormats $img.MediaType.SubType) (eq $prod true)}}
{{- if site.Params.label.iconHeight }} {{- if site.Params.logo.iconHeight }}
{{- $img = $img.Resize (printf "x%d" site.Params.label.iconHeight) }} {{- $img = $img.Resize (printf "x%d" site.Params.logo.iconHeight) }}
{{ else }} {{ else }}
{{- $img = $img.Resize "x30" }} {{- $img = $img.Resize "x30" }}
{{- end }} {{- end }}
{{- end }} {{- end }}
<img src="{{ $img.Permalink }}" alt="logo" aria-label="logo" <img src="{{ $img.Permalink }}" alt="logo" aria-label="logo"
height="{{- site.Params.label.iconHeight | default "30" -}}"> height="{{- site.Params.logo.iconHeight | default "30" -}}">
{{- else }} {{- else }}
<img src="{{- site.Params.label.icon | absURL -}}" alt="logo" aria-label="logo" <img src="{{- site.Params.logo.icon | absURL -}}" alt="logo" aria-label="logo"
height="{{- site.Params.label.iconHeight | default "30" -}}"> height="{{- site.Params.logo.iconHeight | default "30" -}}">
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $label_text -}} {{- $label_text -}}

View File

@ -7,7 +7,7 @@
"name": {{ site.Title }}, "name": {{ site.Title }},
"url": {{ site.BaseURL }}, "url": {{ site.BaseURL }},
"description": {{ site.Params.description | plainify | truncate 180 | safeHTML }}, "description": {{ site.Params.description | plainify | truncate 180 | safeHTML }},
"thumbnailUrl": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }}, "thumbnailUrl": {{ site.Params.favicon | default "favicon.ico" | absURL }},
"sameAs": [ "sameAs": [
{{- if site.Params.schema.sameAs }} {{- if site.Params.schema.sameAs }}
{{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }} {{ range $i, $e := site.Params.schema.sameAs }}{{ if $i }}, {{ end }}{{ trim $e " " }}{{ end }}
@ -109,7 +109,7 @@
"name": {{ site.Title }}, "name": {{ site.Title }},
"logo": { "logo": {
"@type": "ImageObject", "@type": "ImageObject",
"url": {{ site.Params.assets.favicon | default "favicon.ico" | absURL }} "url": {{ site.Params.favicon | default "favicon.ico" | absURL }}
} }
} }
} }