mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-16 05:32:24 +00:00
Large storage custom nas (#62)
NAS Storage blog post Added `aimage`, `bimage`, `bgallery` and `fimage` custom shortcodes
This commit is contained in:
24
themes/lhs/layouts/shortcodes/aimage.html
Normal file
24
themes/lhs/layouts/shortcodes/aimage.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
||||
{{ $width := .Get "width" }}
|
||||
{{ $height := .Get "height" }}
|
||||
{{ $title := .Get "title" }}
|
||||
{{ $class := .Get "class" }}
|
||||
{{- with .Parent -}}
|
||||
<div style="width:{{$width}}px">
|
||||
{{ end }}
|
||||
<figure class="image{{ if $class }} {{ $class }}{{ end }}">
|
||||
<img src="{{ $img.RelPermalink }}" width="{{$width}}px" heigth="{{$height}}px" {{ if $title }}
|
||||
alt="{{ $title }}" {{ end }}>
|
||||
{{ if $title }}
|
||||
<figcaption class="is-size-6">
|
||||
<small>
|
||||
{{ $title }}
|
||||
</small>
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{- with .Parent -}}
|
||||
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
12
themes/lhs/layouts/shortcodes/bgallery.html
Normal file
12
themes/lhs/layouts/shortcodes/bgallery.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!-- Start Carousel -->
|
||||
{{ $width := .Get "width" }}
|
||||
|
||||
<div style="margin: auto; width: 80%;">
|
||||
|
||||
<div style="display: block; margin-left: auto; margin-right: auto; width: {{ $width }}%">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- End Carousel -->
|
||||
26
themes/lhs/layouts/shortcodes/bimage.html
Normal file
26
themes/lhs/layouts/shortcodes/bimage.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
||||
{{ $width := .Get "width" }}
|
||||
{{ $height := .Get "height" }}
|
||||
{{ $zone := .Get "zone" }}
|
||||
{{ $img = $img.Resize (print (default "1264x" $width) " webp") }}
|
||||
{{ $title := .Get "title" }}
|
||||
{{ $class := .Get "class" }}
|
||||
{{- with .Parent -}}
|
||||
<div>
|
||||
{{ end }}
|
||||
<div style="display: block; margin-left: auto; margin-right: auto; width: {{ $zone }}%;">
|
||||
<figure class="image{{ if $class }} {{ $class }}{{ end }}">
|
||||
<img src="{{ $img.RelPermalink }}" width="{{ $width }}" height="{{ $height }}" {{ if $title }}
|
||||
alt="{{ $title }}" {{ end }}>
|
||||
{{ if $title }}
|
||||
<figcaption class="is-size-6">
|
||||
<small>
|
||||
{{ $title }}
|
||||
</small>
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
</div>
|
||||
{{- with .Parent -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
14
themes/lhs/layouts/shortcodes/fimage.html
Normal file
14
themes/lhs/layouts/shortcodes/fimage.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
||||
{{ $width := .Get "width" }}
|
||||
{{ $height := .Get "height" }}
|
||||
{{ $title := .Get "title" }}
|
||||
{{ $float := .Get "float" }}
|
||||
<img src="{{ $img.RelPermalink }}" style="float:{{$float}}; margin-right:10px;" width="{{$width}}px" heigth="{{$height}}px" {{ if $title }}
|
||||
alt="{{ $title }}" {{ end }}>
|
||||
{{ if $title }}
|
||||
<figcaption class="is-size-6">
|
||||
<small>
|
||||
{{ $title }}
|
||||
</small>
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user