Skip to content
Snippets Groups Projects
Commit 346ba732 authored by Sietze van Buuren's avatar Sietze van Buuren Committed by Walter Lozano
Browse files

Add alignment argument to svg shortcode


This commit adds an alignment argument to the svg short-code, in order to
make it more flexible. This allows to e.g. align an svg image to the
left. With this change, all svg shortcode input arguments are now named:
- `src`: svg file location (required)
- `alignment`: image alignment (optional, default: "center")

The current (old) implementation uses one positional argument (the svg file
location), whereas the (new) implementation in this commit uses two named
arguments. It is not possible to keep the first positional argument and add one
named argument, since Hugo does not allow to mix named and positional
arguments. Therefore, this short-code is not backwards compatible and all
existing svg short-code calls will have to be updated, when adopting this
change!

At least the first argument should be supplied as named argument. Thus, old code
like:

```
{{< svg "/path/to/svg-file" >}}
```

should be replaced with

```
{{< svg src="/path/to/svg-file" >}}
```

or

```
{{< svg src="/path/to/svg-file" alignment="left" >}}
```

if one wants to override the default alignment.

Signed-off-by: default avatarSietze van Buuren <Sietze.vanBuuren@de.bosch.com>
parent d0c61506
No related branches found
No related tags found
Loading
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment