diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1071c32..496a8ce 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -13,6 +13,7 @@ DefaultContentLanguage = "en" # Theme i18n support [params] mainSections = ["post"] favicon = "" + featuredImageField = "image" [params.dateFormat] published = "Jan 02, 2006" lastUpdated = "Jan 02, 2006 15:04 MST" @@ -37,9 +38,21 @@ DefaultContentLanguage = "en" # Theme i18n support [params.widgets.tagCloud] limit = 10 [params.opengraph] - defaultImage = "" [params.opengraph.twitter] site = "" + [params.defaultImage] + [params.defaultImage.article] + enabled = false + local = false + src = "" + [params.defaultImage.articleList] + enabled = false + local = true + src = "" + [params.defaultImage.opengraph] + enabled = false + local = false + src = "" [menu] [[menu.main]] diff --git a/layouts/_default/term.html b/layouts/_default/term.html index cae47d1..0b63549 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -15,12 +15,16 @@ {{ end }} - {{ if .Params.image }} - {{- $image := partial "helper/image" . -}} - {{- $thumbnail := $image.Fill "120x120" -}} + {{ $image := partial "helper/image" (dict "Context" . "Type" "taxonomy") }} + {{ if $image.exists }}
- + {{ if $image.resource }} + {{- $thumbnail := $image.resource.Fill "120x120" -}} + + {{ else }} + + {{ end }}
{{ end }} diff --git a/layouts/partials/article-list/compact.html b/layouts/partials/article-list/compact.html index 3988b83..1a71318 100644 --- a/layouts/partials/article-list/compact.html +++ b/layouts/partials/article-list/compact.html @@ -12,13 +12,17 @@ - {{ if .Params.image }} - {{- $image := partial "helper/image" . -}} - {{- $thumbnail := $image.Fill "120x120" -}} + {{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }} -
- -
+ {{ if $image.exists }} +
+ {{ if $image.resource }} + {{- $thumbnail := $image.resource.Fill "120x120" -}} + + {{ else }} + Featured image of post {{ .Title }} + {{ end }} +
{{ end }} \ No newline at end of file diff --git a/layouts/partials/article-list/default.html b/layouts/partials/article-list/default.html index 25fcbc2..8c59ff7 100644 --- a/layouts/partials/article-list/default.html +++ b/layouts/partials/article-list/default.html @@ -1,17 +1,21 @@ -
- {{ if .Params.image }} - {{- $image := partial "helper/image" . -}} - {{- $thumbnail := $image.Fill "800x250" -}} - {{- $thumbnailRetina := $image.Fill "1600x500" -}} +{{ $image := partial "helper/image" (dict "Context" . "Type" "articleList") }} +
+ {{ if $image.exists }} +
+ + {{ if $image.resource }} + {{- $thumbnail := $image.resource.Fill "800x250" -}} + {{- $thumbnailRetina := $image.resource.Fill "1600x500" -}} -
- - Featured image of post {{ .Title }} - -
+ Featured image of post {{ .Title }} + {{ else }} + Featured image of post {{ .Title }} + {{ end }} + +
{{ end }} {{ partial "article/components/details" . }} diff --git a/layouts/partials/article-list/tile.html b/layouts/partials/article-list/tile.html index 9a58d4b..ea38a83 100644 --- a/layouts/partials/article-list/tile.html +++ b/layouts/partials/article-list/tile.html @@ -1,12 +1,19 @@ -
+{{ $image := partial "helper/image" (dict "Context" .context "Type" .Type) }} +
- {{ if .context.Params.image }} - {{- $image := partial "helper/image" .context | resources.Fingerprint "md5" -}} - {{- $thumbnail := $image.Fill .size -}} -
- -
+ + {{ if $image.exists }} +
+ {{ if $image.resource }} + {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}} + {{- $thumbnail := $imageRaw.Fill .size -}} + + + {{ else }} + + {{ end }} +
{{ end }}
diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index 4349d61..0a8f777 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -1,15 +1,14 @@ -{{ $i := .Params.image }} +{{ $image := partial "helper/image" (dict "Context" .) }} {{ $context := . }} -
{{ with $categories := .Params.categories }}