In operator for maps

Hi, how do I check for the presence of a value in maps of attributes ? Attributes.class in particular, in render-image.html. In doesn’t work, and strings.Contains either, nor does string (.Attributes.Class). Or are any of these methods supposed to work?

First, I assume your site config has:

[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false # default is true

[markup.goldmark.parser.attribute]
title = true # default is true; applies to h1-h6 elements
block = true # default is false; applies to other block-level elements

Second, I assume your markdown looks like

![alt](a.jpg)
{.foo .bar}

Third, .Attributes.Class is not a thing. You want .Attributes.class. When in doubt, use something like this to inspect:

<pre>{{ jsonify (dict "indent" "  ") .Attributes }}</pre>

Fourth, assuming you’ve done all of the above, this works as expected:

{{ in .Attributes.class "foo" }}
1 Like

case-sensitivity. again. Ok.

Do you remember the private conversations we had, under your previous account, about behavior and attitude?

1 Like

yes, and sometimes frustation gets the better of me. Corrected, sorry.
And thanks I finally got the ultra perfect optimized responsive image code I always wanted. I saw that it works. Providing certainly less than a marginal improvement, but I feel good now…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.