Files
hugo/content/functions/dict.md
T
Bjørn Erik Pedersen 572b9e7590 Clean up the code shortcode use
* No markdown needed
* No code fence needed

See #61
2017-07-20 11:51:45 +02:00

1.8 KiB

title, description, godocref, workson, date, publishdate, lastmod, categories, menu, signature, workson, hugoversion, relatedfuncs, deprecated, aliases
title description godocref workson date publishdate lastmod categories menu signature workson hugoversion relatedfuncs deprecated aliases
dict Creates a dictionary from a list of key and value pairs.
2017-02-01 2017-02-01 2017-02-26
functions
docs
parent
functions
dict KEY VALUE [KEY VALUE]...
false

title: dict description: Creates a dictionary from a list of key and value pairs. godocref: workson: [] date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-26 categories: [functions] menu: docs: parent: "functions" #tags: [dictionary] signature: ["dict KEY VALUE [KEY VALUE]..."] workson: [] hugoversion: relatedfuncs: [] deprecated: false aliases: []

dict is especially useful for passing more than one value to a partial template.

Example: dict with Embedded SVGs

The partial below creates a SVG and expects fill height and width from the caller:

{{< code file="layouts/partials/svgs/external-links.svg" download="external-links.svg" >}} {{< /code >}}

These values can be stored in one object with dict and passed to the partial:

{{< code file="layouts/_default/list.html" >}} {{ partial "svg/link-ext.svg" (dict "fill" "#01589B" "size" 10 "width" 20 ) }} {{< /code >}}