Merge pull request #121 from nunocoracao/120-improve-ui-options-for-hero-image
added multiple options to display hero images
|
@ -1510,18 +1510,14 @@ select {
|
||||||
margin-top: 1.25rem;
|
margin-top: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-2\.5 {
|
.mt-1 {
|
||||||
margin-top: 0.625rem;
|
margin-top: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mb-6 {
|
.mb-6 {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-2 {
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-3 {
|
.mt-3 {
|
||||||
margin-top: 0.75rem;
|
margin-top: 0.75rem;
|
||||||
}
|
}
|
||||||
|
@ -1594,10 +1590,6 @@ select {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-1 {
|
|
||||||
margin-top: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mb-\[2px\] {
|
.mb-\[2px\] {
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
@ -1638,14 +1630,18 @@ select {
|
||||||
height: 6rem;
|
height: 6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h-36 {
|
|
||||||
height: 9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.h-8 {
|
.h-8 {
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.h-\[45vh\] {
|
||||||
|
height: 45vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h-36 {
|
||||||
|
height: 9rem;
|
||||||
|
}
|
||||||
|
|
||||||
.h-48 {
|
.h-48 {
|
||||||
height: 12rem;
|
height: 12rem;
|
||||||
}
|
}
|
||||||
|
@ -1955,6 +1951,10 @@ select {
|
||||||
background-color: rgba(var(--color-neutral-100), 0.5);
|
background-color: rgba(var(--color-neutral-100), 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-gradient-to-t {
|
||||||
|
background-image: linear-gradient(to top, var(--tw-gradient-stops));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-gradient-to-b {
|
.bg-gradient-to-b {
|
||||||
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
|
background-image: linear-gradient(to bottom, var(--tw-gradient-stops));
|
||||||
}
|
}
|
||||||
|
@ -1963,12 +1963,22 @@ select {
|
||||||
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.from-neutral {
|
||||||
|
--tw-gradient-from: rgba(var(--color-neutral), 1);
|
||||||
|
--tw-gradient-to: rgba(var(--color-neutral), 0);
|
||||||
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
||||||
|
}
|
||||||
|
|
||||||
.from-primary-500 {
|
.from-primary-500 {
|
||||||
--tw-gradient-from: rgba(var(--color-primary-500), 1);
|
--tw-gradient-from: rgba(var(--color-primary-500), 1);
|
||||||
--tw-gradient-to: rgba(var(--color-primary-500), 0);
|
--tw-gradient-to: rgba(var(--color-primary-500), 0);
|
||||||
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.to-transparent {
|
||||||
|
--tw-gradient-to: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.to-secondary-700 {
|
.to-secondary-700 {
|
||||||
--tw-gradient-to: rgba(var(--color-secondary-700), 1);
|
--tw-gradient-to: rgba(var(--color-secondary-700), 1);
|
||||||
}
|
}
|
||||||
|
@ -2281,6 +2291,10 @@ select {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mix-blend-normal {
|
||||||
|
mix-blend-mode: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.mix-blend-multiply {
|
.mix-blend-multiply {
|
||||||
mix-blend-mode: multiply;
|
mix-blend-mode: multiply;
|
||||||
}
|
}
|
||||||
|
@ -2992,12 +3006,32 @@ body:has(#menu-controller:checked) {
|
||||||
background-position:center;
|
background-position:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.single_hero {
|
.single_hero_basic {
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
background-size:cover;
|
background-size:cover;
|
||||||
background-position:center;
|
background-position:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.single_hero_round {
|
||||||
|
max-height: 50vh;
|
||||||
|
-o-object-fit: cover;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single_hero_background {
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
background-size:cover;
|
||||||
|
background-position:center;
|
||||||
|
width: calc(100% + 40px);
|
||||||
|
z-index: -10;
|
||||||
|
margin-left: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero_gradient {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.thumbnailshadow {
|
.thumbnailshadow {
|
||||||
box-shadow: 5px 5px 20px 1px rgba(0, 0, 0, 0.3);
|
box-shadow: 5px 5px 20px 1px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
@ -3352,6 +3386,12 @@ body:has(#menu-controller:checked) {
|
||||||
background-color: rgba(var(--color-primary-800), var(--tw-bg-opacity));
|
background-color: rgba(var(--color-primary-800), var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dark .dark\:from-neutral-800 {
|
||||||
|
--tw-gradient-from: rgba(var(--color-neutral-800), 1);
|
||||||
|
--tw-gradient-to: rgba(var(--color-neutral-800), 0);
|
||||||
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
||||||
|
}
|
||||||
|
|
||||||
.dark .dark\:from-primary-600 {
|
.dark .dark\:from-primary-600 {
|
||||||
--tw-gradient-from: rgba(var(--color-primary-600), 1);
|
--tw-gradient-from: rgba(var(--color-primary-600), 1);
|
||||||
--tw-gradient-to: rgba(var(--color-primary-600), 0);
|
--tw-gradient-to: rgba(var(--color-primary-600), 0);
|
||||||
|
|
|
@ -347,12 +347,31 @@ body:has(#menu-controller:checked) {
|
||||||
background-position:center;
|
background-position:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.single_hero {
|
.single_hero_basic {
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
background-size:cover;
|
background-size:cover;
|
||||||
background-position:center;
|
background-position:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.single_hero_round {
|
||||||
|
max-height: 50vh;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.single_hero_background {
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
background-size:cover;
|
||||||
|
background-position:center;
|
||||||
|
width: calc(100% + 40px);
|
||||||
|
z-index: -10;
|
||||||
|
margin-left: -20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero_gradient {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.thumbnailshadow {
|
.thumbnailshadow {
|
||||||
box-shadow: 5px 5px 20px 1px rgba(0, 0, 0, 0.3);
|
box-shadow: 5px 5px 20px 1px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ enableCodeCopy = true
|
||||||
showDateUpdated = false
|
showDateUpdated = false
|
||||||
showAuthor = true
|
showAuthor = true
|
||||||
showHero = true
|
showHero = true
|
||||||
|
heroStyle = "basic" # valid options: basic, big, background
|
||||||
showBreadcrumbs = true
|
showBreadcrumbs = true
|
||||||
showDraftLabel = true
|
showDraftLabel = true
|
||||||
showEdit = true
|
showEdit = true
|
||||||
|
|
|
@ -36,6 +36,7 @@ mainSections = ["docs"]
|
||||||
showDateUpdated = false
|
showDateUpdated = false
|
||||||
showAuthor = true
|
showAuthor = true
|
||||||
showHero = true
|
showHero = true
|
||||||
|
heroStyle = "background" # valid options: basic, big, background
|
||||||
showBreadcrumbs = true
|
showBreadcrumbs = true
|
||||||
showDraftLabel = true
|
showDraftLabel = true
|
||||||
showEdit = true
|
showEdit = true
|
||||||
|
|
|
@ -146,6 +146,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|`article.showDateUpdated`|`false`|Whether or not the dates articles were updated are displayed.|
|
|`article.showDateUpdated`|`false`|Whether or not the dates articles were updated are displayed.|
|
||||||
|`article.showAuthor`|`true`|Whether or not the author box is displayed in the article footer.|
|
|`article.showAuthor`|`true`|Whether or not the author box is displayed in the article footer.|
|
||||||
|`article.showHero`|`true`|Whether the thumbnail image will be shown as a hero image within each article page.|
|
|`article.showHero`|`true`|Whether the thumbnail image will be shown as a hero image within each article page.|
|
||||||
|
|`heroStyle`|`basic`|Style to display the hero image, valid options are: `basic`, `big`, `background`.|
|
||||||
|`article.showBreadcrumbs`|`false`|Whether or not breadcrumbs are displayed in the article header.|
|
|`article.showBreadcrumbs`|`false`|Whether or not breadcrumbs are displayed in the article header.|
|
||||||
|`article.showDraftLabel`|`true`|Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`.|
|
|`article.showDraftLabel`|`true`|Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`.|
|
||||||
|`article.showEdit`|`false`|Whether or not the link to edit the article content should be displayed.|
|
|`article.showEdit`|`false`|Whether or not the link to edit the article content should be displayed.|
|
||||||
|
|
|
@ -27,6 +27,7 @@ Front matter parameter default values are inherited from the theme's [base confi
|
||||||
|`authors`|_Not set_|Array of values for authors, if set it overrides `showAuthor` settings for page or site. Used on the multiple authors feature, check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.|
|
|`authors`|_Not set_|Array of values for authors, if set it overrides `showAuthor` settings for page or site. Used on the multiple authors feature, check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.|
|
||||||
|`showAuthorsBadges`|`article.showAuthorsBadges`|Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.|
|
|`showAuthorsBadges`|`article.showAuthorsBadges`|Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature.|
|
||||||
|`showHero`|`article.showHero`|Whether the thumbnail image will be shown as a hero image within the article page.|
|
|`showHero`|`article.showHero`|Whether the thumbnail image will be shown as a hero image within the article page.|
|
||||||
|
|`heroStyle`|`article.heroStyle`|Style to display the hero image, valid options are: `basic`, `big`, `background`.|
|
||||||
|`showBreadcrumbs`|`article.showBreadcrumbs` or `list.showBreadcrumbs`|Whether the breadcrumbs are displayed in the article or list header.|
|
|`showBreadcrumbs`|`article.showBreadcrumbs` or `list.showBreadcrumbs`|Whether the breadcrumbs are displayed in the article or list header.|
|
||||||
|`showDate`|`article.showDate`|Whether or not the article date is displayed. The date is set using the `date` parameter.|
|
|`showDate`|`article.showDate`|Whether or not the article date is displayed. The date is set using the `date` parameter.|
|
||||||
|`showDateUpdated`|`article.showDateUpdated`|Whether or not the date the article was updated is displayed. The date is set using the `lastmod` parameter.|
|
|`showDateUpdated`|`article.showDateUpdated`|Whether or not the date the article was updated is displayed. The date is set using the `lastmod` parameter.|
|
||||||
|
|
After Width: | Height: | Size: 950 KiB |
After Width: | Height: | Size: 782 KiB |
After Width: | Height: | Size: 1,001 KiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 926 KiB |
After Width: | Height: | Size: 1 MiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 988 KiB |
After Width: | Height: | Size: 992 KiB |
After Width: | Height: | Size: 976 KiB |
After Width: | Height: | Size: 1.7 MiB |
After Width: | Height: | Size: 1.7 MiB |
|
@ -1,7 +1,14 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<article>
|
<article>
|
||||||
{{ partial "hero.html" . }}
|
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
|
||||||
<header class="mt-5 max-w-prose">
|
{{ $heroStyle := print "partials/hero/" .Site.Params.article.heroStyle ".html" }}
|
||||||
|
{{ if templates.Exists $heroStyle }}
|
||||||
|
{{ partial $heroStyle . }}
|
||||||
|
{{ else }}
|
||||||
|
{{ partial "partials/hero/basic.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
<header id="single_header" class="mt-5 max-w-prose">
|
||||||
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
|
{{ if .Params.showBreadcrumbs | default (.Site.Params.article.showBreadcrumbs | default false) }}
|
||||||
{{ partial "breadcrumbs.html" . }}
|
{{ partial "breadcrumbs.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -136,6 +143,15 @@
|
||||||
remove_like_article(id_likes)
|
remove_like_article(id_likes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var header = document.getElementById("single_header")
|
||||||
|
var style = getComputedStyle(header);
|
||||||
|
console.log(style, style.height)
|
||||||
|
var margin = '-'+ (parseInt(style.height) + parseInt(style.marginTop) + parseInt(style.marginBottom) + 20) + 'px'
|
||||||
|
console.log(margin)
|
||||||
|
var hero = document.getElementById('hero')
|
||||||
|
if(hero)
|
||||||
|
hero.style["margin-bottom"] = margin;
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
<footer class="pt-8 max-w-prose print:hidden">
|
<footer class="pt-8 max-w-prose print:hidden">
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{{ if .Params.showHero | default (.Site.Params.article.showHero | default false) }}
|
|
||||||
{{- $images := .Resources.ByType "image" -}}
|
|
||||||
{{- $featured := $images.GetMatch "*feature*" -}}
|
|
||||||
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
|
||||||
{{- with $featured -}}
|
|
||||||
{{ with .Resize "600x" }}
|
|
||||||
<div class="w-full h-36 md:h-56 lg:h-72 single_hero nozoom" style="background-image:url({{ .RelPermalink }});"></div>
|
|
||||||
{{ end }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
10
layouts/partials/hero/background.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{{- $images := .Resources.ByType "image" -}}
|
||||||
|
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||||
|
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||||
|
{{- with $featured -}}
|
||||||
|
{{ with .Resize "1200x" }}
|
||||||
|
<div id="hero" class="relative h-[45vh] single_hero_background nozoom" style="background-image:url({{ .RelPermalink }});">
|
||||||
|
<div class="hero_gradient bg-gradient-to-t from-neutral dark:from-neutral-800 to-transparent mix-blend-normal"></div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
8
layouts/partials/hero/basic.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{{- $images := .Resources.ByType "image" -}}
|
||||||
|
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||||
|
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||||
|
{{- with $featured -}}
|
||||||
|
{{ with .Resize "1200x" }}
|
||||||
|
<div class="w-full h-36 md:h-56 lg:h-72 single_hero_basic nozoom" style="background-image:url({{ .RelPermalink }});"></div>
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
8
layouts/partials/hero/big.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{{- $images := .Resources.ByType "image" -}}
|
||||||
|
{{- $featured := $images.GetMatch "*feature*" -}}
|
||||||
|
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||||
|
{{- with $featured -}}
|
||||||
|
{{ with .Resize "1200x" }}
|
||||||
|
<img class="w-full rounded-lg single_hero_round nozoom" src="{{ .RelPermalink }}">
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|