simplify render-image using hasPrefix()
This commit is contained in:
parent
b55fe8a7f0
commit
1b99a6c434
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prenote": "node hooks/prenote.js",
|
"prenote": "node hooks/prenote.js",
|
||||||
"precommit": "node hooks/precommit.js",
|
"precommit": "node hooks/precommit.js",
|
||||||
"search": "echo 'executing pagefind (locally)...' && /Users/wgroeneveld/.cargo/bin/pagefind --source docs --bundle-dir ../static/_pagefind",
|
"search": "echo 'executing Hugo+Pagefind (locally)...' && /opt/homebrew/bin/hugo && /Users/wgroeneveld/.cargo/bin/pagefind --source docs --bundle-dir ../static/_pagefind",
|
||||||
"postdeploy": "node hooks/postdeploy.js"
|
"postdeploy": "node hooks/postdeploy.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
#search
|
#search
|
||||||
input
|
input
|
||||||
width: 100%
|
width: 100%
|
||||||
|
padding: 9px 4px 9px 40px
|
||||||
|
border: 1px solid var(--accent)
|
||||||
|
border-radius: 5px
|
||||||
|
background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat 13px center
|
||||||
|
|
||||||
button
|
button
|
||||||
background-color: white
|
background-color: white
|
||||||
border: 1px solid var(--accent)
|
border: 1px solid var(--accent)
|
||||||
|
@ -28,7 +33,7 @@
|
||||||
border-top: 1px solid lightgray
|
border-top: 1px solid lightgray
|
||||||
|
|
||||||
&-thumb
|
&-thumb
|
||||||
width: 30%
|
width: 40%
|
||||||
max-width: 120px
|
max-width: 120px
|
||||||
margin-top: 10px
|
margin-top: 10px
|
||||||
aspect-ratio: 3 / 2
|
aspect-ratio: 3 / 2
|
||||||
|
@ -37,10 +42,8 @@
|
||||||
img
|
img
|
||||||
display: block
|
display: block
|
||||||
position: absolute
|
position: absolute
|
||||||
left: 50%
|
|
||||||
transform: translateX(-50%)
|
|
||||||
font-size: 0
|
font-size: 0
|
||||||
width: auto
|
width: auto
|
||||||
height: auto
|
height: auto
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
max-height: 100%
|
max-height: 150%
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
{{ $url := .Destination }}
|
||||||
<figure>
|
<figure>
|
||||||
{{ $url := .Destination }}
|
{{ if or (hasPrefix $url "/") (hasPrefix $url "https://") (hasPrefix $url "http://") }}
|
||||||
{{ $url = replaceRE `^../(.*?)` (printf "%s%s" .Page.Permalink "../$1") $url }}
|
{{ else }}
|
||||||
|
{{ $url = (printf "%s%s" .Page.Permalink $url) }}
|
||||||
|
{{ end }}
|
||||||
<a href="{{ $url | absURL }}" class="lbox">
|
<a href="{{ $url | absURL }}" class="lbox">
|
||||||
<img src="{{ $url | absURL }}" loading="lazy"{{ with .Text }} alt="{{ . }}"{{ end }}{{ with .Title}} title="{{ . }}"{{ end }}>
|
<img src="{{ $url | absURL }}" loading="lazy"{{ with .Text }} alt="{{ . }}"{{ end }}{{ with .Title}} title="{{ . }}"{{ end }}>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue