-
- Downloads
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:
Sietze van Buuren <Sietze.vanBuuren@de.bosch.com>
Loading
Please register or sign in to comment