diff options
| -rw-r--r-- | README.md | 15 | ||||
| -rw-r--r-- | layouts/_default/single.html | 2 | ||||
| -rw-r--r-- | layouts/index.html | 2 | ||||
| -rw-r--r-- | layouts/shortcodes/center-image.html | 10 | ||||
| -rw-r--r-- | layouts/shortcodes/center.html | 3 |
5 files changed, 30 insertions, 2 deletions
@@ -280,6 +280,21 @@ You can reference any content in the page bundle, such as additional images, in  ``` +##### Shortcodes + +###### Centered Text + +Example: + +{{% center %}}Text to be centered{{% /center %}} + + +###### Centered Image + +{{% center-image +src="x400_board.png" +alt="This is sample image" %}} + ## Site Local Assets and Online Dependencies diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9abdc75..4ac5d36 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,7 @@ <div class="columns"> <div class="column"> <figure class="image "> - {{ with .Resources.GetMatch "header.jpg" }} + {{ with .Resources.GetMatch "header.*" }} <img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}"> {{ end }} </figure> diff --git a/layouts/index.html b/layouts/index.html index 4e796ec..5f5b88d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -22,7 +22,7 @@ <div class="columns"> <div class="column"> <figure class="image "> - {{ with .Resources.GetMatch "header.jpg" }} + {{ with .Resources.GetMatch "header.*" }} <img src="data:{{ .MediaType }};base64,{{ .Content | base64Encode }}"> {{ end }} </figure> diff --git a/layouts/shortcodes/center-image.html b/layouts/shortcodes/center-image.html new file mode 100644 index 0000000..e60217b --- /dev/null +++ b/layouts/shortcodes/center-image.html @@ -0,0 +1,10 @@ +{{ $src := .Get "src" }} +{{ $alt := .Get "alt" }} + +<div class="columns is-centered"> + <img + src="{{ $src }}" + alt="{{ $alt }}" + decoding="async" + /> +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/center.html b/layouts/shortcodes/center.html new file mode 100644 index 0000000..93a13f1 --- /dev/null +++ b/layouts/shortcodes/center.html @@ -0,0 +1,3 @@ +<div class="columns is-centered"> + {{.Inner}} +</div>
\ No newline at end of file |
