diff options
author | kdevo <kdevo@users.noreply.github.com> | 2021-04-11 02:13:24 +0300 |
---|---|---|
committer | kdevo <kdevo@users.noreply.github.com> | 2021-04-11 02:13:24 +0300 |
commit | 59b7ab0b1b7e94d47f563ad5ee6eb8b79e498293 (patch) | |
tree | 603639881e0275e3f5c217f8988d5512e1828170 /layouts | |
parent | 1aa02a45fbbbb80e80bc19ca262613632ee77e7b (diff) |
:boom: :wrench: Improve customizability for buttons and more
* allow custom buttons
* change GitHub type handling
(removed explicit gallery type "github",
assume type if repo set instead)
* fix onLogoClick() for easter egg support
* only use new partial section from menu if it has an actual content page
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/body-top.html | 3 | ||||
-rw-r--r-- | layouts/partials/sections/gallery/modals.html | 31 |
3 files changed, 12 insertions, 24 deletions
diff --git a/layouts/index.html b/layouts/index.html index dd1d1ff..d2a6e72 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -10,7 +10,7 @@ {{ $partial := printf "partials/sections/%s.html" $m.Identifier }} {{ if templates.Exists $partial }} {{ partial $partial $m.Page }} - {{ else }} + {{ else if .Page }} {{ partial "partials/sections/default.html" $m.Page }} {{- end }} </section> diff --git a/layouts/partials/body-top.html b/layouts/partials/body-top.html index 67bf6ce..5a62427 100644 --- a/layouts/partials/body-top.html +++ b/layouts/partials/body-top.html @@ -43,9 +43,10 @@ class="lazyload" {{ else }} src="{{ $scratch.Get "img" }}" - onclick="onLogoClick()" + loading="lazy" {{ end }} alt="{{ .Site.Title }}" + onclick="onLogoClick()" > </a> </div> diff --git a/layouts/partials/sections/gallery/modals.html b/layouts/partials/sections/gallery/modals.html index 8fb7f93..4687381 100644 --- a/layouts/partials/sections/gallery/modals.html +++ b/layouts/partials/sections/gallery/modals.html @@ -3,7 +3,7 @@ {{ $modalID := .File.BaseFileName }} {{ $scratch := newScratch }} - {{ if eq .Params.type "github" -}} + {{ if .Params.github.repo -}} {{ $scratch.Set "repo" (getJSON "https://api.github.com/repos/" .Params.github.repo) }} {{- end }} @@ -36,24 +36,14 @@ </article> <!-- Links --> <div class="row center-xs"> - {{ if .Params.linkView -}} + {{ range .Params.buttons -}} <div class="col-xs"> - <div class="box"> - <a href="{{ .Params.linkView }}"> - <button type="submit"><span class="icon icon-angle-circled-right"></span> {{ i18n "view" }}</button> - </a> - </div> - </div> - {{- end }} - {{ if .Params.linkCode -}} - <div class="col-xs"> - <div class="box"> - <a href="{{ .Params.linkCode }}" target="_blank"> - <button type="submit"><span class="icon icon-terminal"></span>{{ i18n "code" }}</button> - </a> - </div> + <a href="{{ .url }}" {{ if default true .newTab -}}target="_blank"{{- end }}> + <button type="submit"><span class="icon icon-{{ default "angle-circled-right" .icon }}"></span> {{ i18n (default "view" .i18n) }}</button> + </a> </div> - {{- else -}} + {{- else -}} + {{ if (default true .Params.github.showButtons) }} {{ with $scratch.Get "repo" -}} <div class="col-xs"> <div class="box"> @@ -62,8 +52,6 @@ </a> </div> </div> - {{- end }} - {{ with $scratch.Get "repo" -}} <div class="col-xs"> <div class="box"> <a href="{{ .html_url }}" target="_blank"> @@ -72,8 +60,8 @@ </div> </div> {{- end }} - {{- end }} - + {{ end }} + {{- end }} </div> {{ if .Params.github.showInfo }} @@ -94,7 +82,6 @@ </div></div>{{ end }}{{ end }} </div> - {{ if .Params.terminal.lines -}} <div class="term-content"> <div id="term-{{ $modalID }}" data-termynal> |