Add func-url.html

master
Will Faught 3 years ago
parent b20b0008bc
commit 168be4b1a4

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 324 KiB

@ -3,11 +3,11 @@
{{ partial "paige/metadata.html" . }}
<section>
{{ with .Params.stretch }}
<div class="mb-3 mw-100 rounded-4 shadow" style="background-image: url('{{ relLangURL . }}'); background-position: center; background-size: cover; height: 20rem"></div>
<div class="mb-3 mw-100 rounded-4 shadow" style="background-image: url('{{ partial `paige/func-url.html` . }}'); background-position: center; background-size: cover; height: 20rem"></div>
{{ end }}
{{ with .Params.center }}
<p class="text-center">
<img class="mw-100 rounded-4 shadow" fetchpriority="high" referrerpolicy="no-referrer" src="{{ relLangURL . }}" style="max-height: 20rem">
<img class="mw-100 rounded-4 shadow" fetchpriority="high" referrerpolicy="no-referrer" src="{{ partial `paige/func-url.html` . }}" style="max-height: 20rem">
</p>
{{ end }}
{{ with .Params.greeting }}

@ -0,0 +1,12 @@
{{ $url := . }}
{{ if eq $url (urls.Parse $url).Path }}
{{ with resources.Get (relLangURL $url) }}
{{ if ne .ResourceType "image" }}
{{ $url = $url | minify }}
{{ end }}
{{ $url = (. | fingerprint).RelPermalink }}
{{ else }}
{{ $url = relLangURL $url }}
{{ end }}
{{ end }}
{{ return $url }}

@ -1,11 +1 @@
{{ $href := .href }}
{{ $path := false }}
{{ if eq $href (urls.Parse $href).Path }}
{{ $path = true }}
{{ with resources.Get (relLangURL $href) }}
{{ $href = (. | minify | fingerprint).RelPermalink }}
{{ else }}
{{ $href = relLangURL $href }}
{{ end }}
{{ end }}
<link{{ if not $path }} crossorigin="anonymous"{{ end }} href="{{ $href }}" integrity="{{ .integrity }}" rel="stylesheet">
<link{{ if ne .href (urls.Parse .href).Path }} crossorigin="anonymous"{{ end }} href="{{ partial `paige/func-url.html` .href }}" integrity="{{ .integrity }}" rel="stylesheet">

@ -1,11 +1 @@
{{ $path := false }}
{{ $src := .src }}
{{ if eq $src (urls.Parse $src).Path }}
{{ $path = true }}
{{ with resources.Get (relLangURL $src) }}
{{ $src = (. | minify | fingerprint).RelPermalink }}
{{ else }}
{{ $src = relLangURL $src }}
{{ end }}
{{ end }}
<script{{ if not $path }} crossorigin="anonymous"{{ end }} defer integrity="{{ .integrity }}"{{ with .onload }} onload="{{ . | safeJS }}"{{ end }} referrerpolicy="no-referrer" src="{{ $src }}"></script>
<script{{ if ne .href (urls.Parse .href).Path }} crossorigin="anonymous"{{ end }} defer integrity="{{ .integrity }}"{{ with .onload }} onload="{{ . | safeJS }}"{{ end }} referrerpolicy="no-referrer" src="{{ partial `paige/func-url.html` .src }}"></script>

Loading…
Cancel
Save