refactor: remove some usages of default in template

No longer needed thanks to Hugo's configuration merge
This commit is contained in:
Jimmy Cai 2022-06-12 13:51:46 +00:00 committed by GitHub
parent de22945155
commit 751d7d1753
8 changed files with 10 additions and 10 deletions

View File

@ -17,7 +17,7 @@
{{- $Height = $image.Height -}} {{- $Height = $image.Height -}}
{{- $galleryImage = true -}} {{- $galleryImage = true -}}
{{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}} {{- if .Page.Site.Params.imageProcessing.content.enabled -}}
{{- $small := $image.Resize `480x` -}} {{- $small := $image.Resize `480x` -}}
{{- $big := $image.Resize `1024x` -}} {{- $big := $image.Resize `1024x` -}}
{{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}} {{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}}

View File

@ -25,7 +25,7 @@
{{- $Width := $image.resource.Width -}} {{- $Width := $image.resource.Width -}}
{{- $Height := $image.resource.Height -}} {{- $Height := $image.resource.Height -}}
{{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $Permalink = $thumbnail.RelPermalink -}} {{- $Permalink = $thumbnail.RelPermalink -}}
{{- $Width = $thumbnail.Width -}} {{- $Width = $thumbnail.Width -}}

View File

@ -7,7 +7,7 @@
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
{{- if $image.exists -}} {{- if $image.exists -}}
{{- $imagePermalink := "" -}} {{- $imagePermalink := "" -}}
{{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- if and $image.resource .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}} {{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
{{- else -}} {{- else -}}

View File

@ -19,7 +19,7 @@
{{- $Width := $image.resource.Width -}} {{- $Width := $image.resource.Width -}}
{{- $Height := $image.resource.Height -}} {{- $Height := $image.resource.Height -}}
{{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}} {{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $Permalink = $thumbnail.RelPermalink -}} {{- $Permalink = $thumbnail.RelPermalink -}}
{{- $Width = $thumbnail.Width -}} {{- $Width = $thumbnail.Width -}}

View File

@ -9,7 +9,7 @@
{{- $Height := $image.resource.Height -}} {{- $Height := $image.resource.Height -}}
{{- $Srcset := "" -}} {{- $Srcset := "" -}}
{{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} {{- if .Page.Site.Params.imageProcessing.cover.enabled -}}
{{- $thumbnail := $image.resource.Resize "800x" -}} {{- $thumbnail := $image.resource.Resize "800x" -}}
{{- $thumbnailRetina := $image.resource.Resize "1600x" -}} {{- $thumbnailRetina := $image.resource.Resize "1600x" -}}
{{- $Srcset = printf "%s 800w, %s 1600w" $thumbnail.RelPermalink $thumbnailRetina.RelPermalink -}} {{- $Srcset = printf "%s 800w, %s 1600w" $thumbnail.RelPermalink $thumbnailRetina.RelPermalink -}}

View File

@ -1,5 +1,5 @@
{{- $defaultColorScheme := default "auto" .Site.Params.colorScheme.default -}} {{- $defaultColorScheme := .Site.Params.colorScheme.default -}}
{{- if not (default false .Site.Params.colorScheme.toggle) -}} {{- if not .Site.Params.colorScheme.toggle -}}
{{/* If toggle is disabled, force default scheme */}} {{/* If toggle is disabled, force default scheme */}}
<script> <script>
(function() { (function() {

View File

@ -11,6 +11,6 @@
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}} {{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}}
{{- if $image.exists -}} {{- if $image.exists -}}
<meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}"> <meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
<meta name="twitter:image" content='{{ absURL $image.permalink }}' /> <meta name="twitter:image" content='{{ absURL $image.permalink }}' />
{{- end -}} {{- end -}}

View File

@ -7,7 +7,7 @@
<header> <header>
{{ with .Site.Params.sidebar.avatar }} {{ with .Site.Params.sidebar.avatar }}
{{ if (default true .enabled) }} {{ if .enabled }}
<figure class="site-avatar"> <figure class="site-avatar">
<a href="{{ .Site.BaseURL | relLangURL }}"> <a href="{{ .Site.BaseURL | relLangURL }}">
{{ if not .local }} {{ if not .local }}
@ -88,7 +88,7 @@
</li> </li>
{{ end }} {{ end }}
{{ if (default false .Site.Params.colorScheme.toggle) }} {{ if .Site.Params.colorScheme.toggle }}
<li id="dark-mode-toggle"> <li id="dark-mode-toggle">
{{ partial "helper/icon" "toggle-left" }} {{ partial "helper/icon" "toggle-left" }}
{{ partial "helper/icon" "toggle-right" }} {{ partial "helper/icon" "toggle-right" }}