Browse Source

Implement some shortcode to safely include critical images instead of using raw html

pull/11/head
Frieder Griesshammer 2 months ago
parent
commit
3151a60a87
  1. 0
      assets/img/das_gebaeude.jpg
  2. 0
      assets/img/der_verein.jpg
  3. 0
      assets/img/die_raeume.jpg
  4. 0
      assets/img/kitty.jpg
  5. 0
      assets/logo.png
  6. 4
      content/dezentrale.md
  7. 6
      content/konto.md
  8. 12
      content/ueber-uns.md
  9. 12
      layouts/shortcodes/resource_image.html

0
static/img/das_gebaeude.jpg → assets/img/das_gebaeude.jpg

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
static/img/der_verein.jpg → assets/img/der_verein.jpg

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
static/img/die_raeume.jpg → assets/img/die_raeume.jpg

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

0
static/img/kitty.jpg → assets/img/kitty.jpg

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

0
static/logo.png → assets/logo.png

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

4
content/dezentrale.md

@ -11,9 +11,7 @@ showmetadates: false
showmetalinks: false
---
<img class="centered pad-vertical" src="/logo.png" alt="Logo">
<br>
{{< resource_image src="logo.png" alt="Logo" >}}
<div class="pure-g">
<div class="pure-u-1-2 centered">

6
content/konto.md

@ -42,10 +42,10 @@ Bitte dazu an den Kassenwart wenden:
---
{{% figure
src="/img/kitty.jpg"
{{< resource_image
src="img/kitty.jpg"
alt="Kleine süße Katze - erhöht die Spendenbereitschaft!"
%}}
>}}
[kitty]: https://www.flickr.com/photos/pargon/2527422080/in/album-72157605279479377/
<small>

12
content/ueber-uns.md

@ -22,7 +22,9 @@ und an Projekten zu basteln.
<div class="pure-g">
<div class="pure-u-1-3 centered">
<h2>Das Gebäude</h2>
<div class="pad-horizontal"><img src="/img/das_gebaeude.jpg" alt="Das Gebäude"/></div>
<div class="pad-horizontal">
{{< resource_image src="img/das_gebaeude.jpg" alt="Das Gebäude" >}}
</div>
<div class="pad-horizontal">
Die dezentrale befindet sich im Hinterhaus der
{{< value "address" "street_number" >}}.
@ -32,7 +34,9 @@ zu erreichen.
</div>
<div class="pure-u-1-3 centered">
<h2>Die Räume</h2>
<div class="pad-horizontal"><img src="/img/die_raeume.jpg" alt="Die Räume"/></div>
<div class="pad-horizontal">
{{< resource_image src="img/die_raeume.jpg" alt="Die Räume" >}}
</div>
<div class="pad-horizontal">
Die dezentrale setzt sich aus mehreren Räumen zusammen — dem Hauptraum
mit großer Elektronik-Werkstatt, Arbeitsplätzen, und einem
@ -44,7 +48,9 @@ Projektraum.
</div>
<div class="pure-u-1-3 centered">
<h2>Der Verein</h2>
<div class="pad-horizontal"><img src="/img/der_verein.jpg" alt="Der Verein"/></div>
<div class="pad-horizontal">
{{< resource_image src="img/der_verein.jpg" alt="Der Verein" >}}
</div>
<div class="pad-horizontal">
Die dezentrale wird von dem Verein {{< value "global" "full_name" >}}
verwaltet. Wir freuen uns immer über Neuzugänge! Schau doch einfach mal vorbei

12
layouts/shortcodes/resource_image.html

@ -0,0 +1,12 @@
{{- $src := default (.Get 0) (.Get "src") }}
{{- if not $src }}
{{- errorf "missing value for 'src': %s" .Position }}
{{- end }}
{{- $alt := default (.Get 1) (.Get "alt") }}
{{- if not $alt }}
{{- errorf "missing value for 'alt': %s" .Position }}
{{- end }}
{{- $img := resources.Get $src | resources.Fingerprint }}
<p>
<img class="centered pad-vertical" src="{{ $img.RelPermalink }}" alt="{{ $alt }}">
</p>
Loading…
Cancel
Save