diff options
author | kdevo <kdevo@users.noreply.github.com> | 2021-04-11 20:00:33 +0300 |
---|---|---|
committer | kdevo <kdevo@users.noreply.github.com> | 2021-04-11 20:00:33 +0300 |
commit | deb43248423e5dc0d749bd333420966e15b5dcab (patch) | |
tree | 81fa933444dd054cc0c0d02daefd7e92adbe84fe | |
parent | 18df084d5cdc6ef97e8720e675d2d9426bf7e39e (diff) |
:recycle: Enhance logo processing, refactor templates
-rw-r--r-- | assets/sass/_animation.scss | 4 | ||||
-rw-r--r-- | assets/sass/_nav.scss | 6 | ||||
-rw-r--r-- | assets/sass/main.scss | 4 | ||||
-rw-r--r-- | layouts/index.html | 6 | ||||
-rw-r--r-- | layouts/partials/body-top.html | 9 | ||||
-rw-r--r-- | layouts/partials/footer.html | 4 | ||||
-rw-r--r-- | layouts/partials/head.html | 1 | ||||
-rw-r--r-- | layouts/partials/logo-img.html | 10 | ||||
-rw-r--r-- | layouts/partials/sections/gallery/img.html | 9 | ||||
-rw-r--r-- | layouts/partials/sections/gallery/modals.html | 35 |
10 files changed, 43 insertions, 45 deletions
diff --git a/assets/sass/_animation.scss b/assets/sass/_animation.scss index 069b865..b7bfce2 100644 --- a/assets/sass/_animation.scss +++ b/assets/sass/_animation.scss @@ -60,10 +60,6 @@ filter: blur(0); } -.logo-anim { - animation: scale-in-center .8s cubic-bezier(.25, .46, .45, .94) both; -} - // Show or hide elements TODO(kdevo): Refactor .show { transition: opacity 600ms; diff --git a/assets/sass/_nav.scss b/assets/sass/_nav.scss index 9a65e35..1689cd3 100644 --- a/assets/sass/_nav.scss +++ b/assets/sass/_nav.scss @@ -16,6 +16,7 @@ div.nav-toggle { padding-left: 30%; } + // opacity: 0; } } @@ -49,6 +50,7 @@ nav { display: inline-block; max-width: 10em; max-height: 2.5em; + width: auto; vertical-align: middle; } @@ -64,10 +66,6 @@ nav { .nav-item-active a { color: $accent; } - - @media (max-width: $mobile-breakpoint) { - // opacity: 0; - } } .nav-fixed { diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 988d021..012cdc7 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -54,8 +54,8 @@ $term_title: "{{ .Site.Data.terminal.title }}"; {{ if .Site.Params.background -}} {{ $scratch := newScratch }} {{ $imgSize := default "1920x" .Site.Params.Image.Background.resize }} - {{ $lqipSize := default "500x" .Site.Params.Image.Background.lqipSize }} - {{ $useLQIP := default true .Site.Params.Image.Background.lqip }} + {{ $lqipSize := default "500x" .Site.Params.Image.Background.sizeLQIP }} + {{ $useLQIP := default .Site.Params.Feat.useLazySizes .Site.Params.Image.Background.useLQIP }} {{ $resizeOptions := default "jpg q90 Lanczos" .Site.Params.Image.Background.resizeOptions }} {{ with (resources.Get .Site.Params.background) -}} {{ $image := .Resize (printf "%s %s" $imgSize $resizeOptions) }} diff --git a/layouts/index.html b/layouts/index.html index d2a6e72..c9c7b0c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -6,14 +6,16 @@ <main> {{ range $i, $m := .Site.Menus.main -}} - <section class="{{ .Identifier }}" id="{{ replace (replace .URL "/" "") "#" "" }}"> {{ $partial := printf "partials/sections/%s.html" $m.Identifier }} {{ if templates.Exists $partial }} + <section class="{{ .Identifier }}" id="{{ replace (replace .URL "/" "") "#" "" }}"> {{ partial $partial $m.Page }} + </section> {{ else if .Page }} + <section class="default" id="{{ replace (replace .URL "/" "") "#" "" }}"> {{ partial "partials/sections/default.html" $m.Page }} + </section> {{- end }} - </section> {{- end }} </main> diff --git a/layouts/partials/body-top.html b/layouts/partials/body-top.html index 5a62427..9f22af2 100644 --- a/layouts/partials/body-top.html +++ b/layouts/partials/body-top.html @@ -30,8 +30,11 @@ <div class="col-xs-6 col-sm-1 logo" style="{{ if not .IsHome }}visibility: visible;{{- end }}"> <a href="{{ "#" | relLangURL }}"> {{ $scratch := newScratch }} + {{ $imgSize := default "64x" .Site.Params.Image.NavLogo.resize }} + {{ $resizeOptions := default "q90" .Site.Params.Image.NavLogo.resizeOptions }} {{ with (resources.Get .Site.Params.logoSmall) -}} - {{ $scratch.Set "img" .Permalink }} + {{ $img := (slice (.Resize (printf "%s %s" $imgSize $resizeOptions))) | resources.Concat (printf "navlogo%s" (path.Ext .)) }} + {{ $scratch.Set "img" $img.Permalink }} {{ $scratch.Set "imgW" .Width }} {{ $scratch.Set "imgH" .Height }} {{- else -}} @@ -45,8 +48,10 @@ src="{{ $scratch.Get "img" }}" loading="lazy" {{ end }} - alt="{{ .Site.Title }}" + alt="Home" onclick="onLogoClick()" + {{ with $scratch.Get "imgH" -}} height="{{ . }}" {{- end }} + {{ with $scratch.Get "imgW" }} width="{{ . }}" {{ end }} > </a> </div> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index ddd11d9..8efb51c 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,7 +1,7 @@ <footer class="row middle-xs center-xs"> {{ range .Site.Params.Social -}} <div class="col-xs-2"> - <a target="_blank" rel="noopener" href="{{ .url }}"><i class="icon icon-{{ .type }}"></i></a> + <a target="_blank" rel="noopener" href="{{ .url }}" alt="{{ .type | humanize }}"><i class="icon icon-{{ .type }}"></i></a> </div> {{- end }} {{ if (.Site.Params.copyright) -}} @@ -12,7 +12,7 @@ {{ end }} {{ if or (.Site.Params.credit) (eq (isset .Site.Params "credit") false) -}} <div class="col-xs-12"> - <small>Theme: <a href="https://github.com/kdevo/osprey-delight" target="_blank">osprey-delight</a> (fork of <a href="https://github.com/tomanistor/osprey" target="_blank">osprey</a>).</small> + <small>Theme: <a href="https://github.com/kdevo/osprey-delight" target="_blank" rel="noopener">osprey-delight</a></small> </div> {{- end }} </small> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index bc19e49..aa19ca7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -14,7 +14,6 @@ <meta name="title" content="{{ .Scratch.Get "title" }}"> <meta charset="utf-8"> - <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="referrer" content="strict-origin-when-cross-origin"> <base href="{{ .Site.BaseURL }}"> diff --git a/layouts/partials/logo-img.html b/layouts/partials/logo-img.html index e8b5e00..ad5ea1e 100644 --- a/layouts/partials/logo-img.html +++ b/layouts/partials/logo-img.html @@ -1,7 +1,7 @@ {{ $scratch := newScratch }} {{ $imgSize := default "1200x" .Site.Params.Image.Logo.resize }} -{{ $lqipSize := default "300x" .Site.Params.Image.Logo.lqipSize }} -{{ $useLQIP := default true .Site.Params.Image.Logo.lqip }} +{{ $lqipSize := default "300x" .Site.Params.Image.Logo.sizeLQIP }} +{{ $useLQIP := default .Site.Params.Feat.useLazySizes .Site.Params.Image.Logo.useLQIP }} {{ $resizeOptions := default "MitchellNetravali q85" .Site.Params.Image.Logo.resizeOptions }} {{ with (resources.Get .Site.Params.logoBig) -}} {{ $image := .Resize (printf "%s %s" $imgSize $resizeOptions) }} @@ -23,7 +23,7 @@ <img src="{{ $scratch.Get "img" }}" alt="{{ .Site.Title }}" - class="home-logo logo-anim" + class="home-logo" loading="lazy" {{ with $scratch.Get "imgH" -}} height="{{ . }}" @@ -46,10 +46,10 @@ {{- end }} data-src="{{ $scratch.Get "img" }}" alt="{{ .Site.Title }}" - class="home-logo blur-up logo-anim lazyload" + class="home-logo blur-up lazyload" {{ else }} src="{{ $scratch.Get "img" }}" - class="home-logo logo-anim" + class="home-logo" {{ end }} {{ with $scratch.Get "imgH" -}} height="{{ . }}" diff --git a/layouts/partials/sections/gallery/img.html b/layouts/partials/sections/gallery/img.html index fe2cd46..d505169 100644 --- a/layouts/partials/sections/gallery/img.html +++ b/layouts/partials/sections/gallery/img.html @@ -1,7 +1,7 @@ {{ $scratch := newScratch }} {{ $imgSize := default "500x" .Site.Params.Image.Gallery.resize }} -{{ $lqipSize := default "2x" .Site.Params.Image.Gallery.lqipSize }} -{{ $useLQIP := default true .Site.Params.Image.Gallery.lqip }} +{{ $lqipSize := default "2x" .Site.Params.Image.Gallery.sizeLQIP }} +{{ $useLQIP := default .Site.Params.Feat.useLazySizes .Site.Params.Image.Gallery.useLQIP }} {{ $resizeOptions := default "MitchellNetravali q85" .Site.Params.Image.Gallery.resizeOptions }} {{ with .Params.image -}} {{ with (resources.Get .) -}} @@ -32,7 +32,7 @@ <noscript> <img src="{{ $scratch.Get "img" }}" - alt="{{ .Site.Title }}" + alt="{{ default .Params.title .Params.alt }}" loading="lazy" {{ with $scratch.Get "imgH" -}} height="{{ . }}" @@ -55,7 +55,6 @@ {{- end }} {{- end }} data-src="{{ $scratch.Get "img" }}" - alt="{{ .Site.Title }}" class="blur-up lazyload" {{ with $scratch.Get "imgH" -}} {{/* TODO(kdevo): Refactor this in SCSS */}} @@ -65,7 +64,7 @@ src="{{ $scratch.Get "img" }}" loading="lazy" {{ end }} +alt="{{ default .Params.title .Params.alt }}" {{ with $scratch.Get "imgH" -}} height="{{ . }}" {{- end }} {{ with $scratch.Get "imgW" }} width="{{ . }}" {{ end }} -{{ if .Params.alt }} alt="{{ .Params.alt }}" {{ end }} >
\ No newline at end of file diff --git a/layouts/partials/sections/gallery/modals.html b/layouts/partials/sections/gallery/modals.html index 4687381..ff44392 100644 --- a/layouts/partials/sections/gallery/modals.html +++ b/layouts/partials/sections/gallery/modals.html @@ -38,29 +38,28 @@ <div class="row center-xs"> {{ range .Params.buttons -}} <div class="col-xs"> - <a href="{{ .url }}" {{ if default true .newTab -}}target="_blank"{{- end }}> + <a href="{{ .url }}" {{ if default false .newTab -}}target="_blank" rel="noopener"{{- end }}> <button type="submit"><span class="icon icon-{{ default "angle-circled-right" .icon }}"></span> {{ i18n (default "view" .i18n) }}</button> </a> </div> - {{- else -}} - {{ if (default true .Params.github.showButtons) }} + {{ end }} + {{ if (default true .Params.github.showButtons) }} {{ with $scratch.Get "repo" -}} - <div class="col-xs"> - <div class="box"> - <a href="{{ replace (replace .archive_url "{/ref}" "") "{archive_format}" "zipball" }}" target="_blank"> - <button type="submit"><span class="icon icon-download"></span>{{ i18n "download" }}</button> - </a> - </div> - </div> - <div class="col-xs"> - <div class="box"> - <a href="{{ .html_url }}" target="_blank"> - <button type="submit"><span class="icon icon-terminal"></span>{{ i18n "code" }}</button> - </a> - </div> - </div> + <div class="col-xs"> + <div class="box"> + <a href="{{ replace (replace .archive_url "{/ref}" "") "{archive_format}" "zipball" }}" target="_blank"> + <button type="submit"><span class="icon icon-download"></span>{{ i18n "download" }}</button> + </a> + </div> + </div> + <div class="col-xs"> + <div class="box"> + <a href="{{ .html_url }}" target="_blank" rel="noopener"> + <button type="submit"><span class="icon icon-terminal"></span>{{ i18n "code" }}</button> + </a> + </div> + </div> {{- end }} - {{ end }} {{- end }} </div> |