# Checking if param is equal template parameter inside range

**URL:** https://discourse.gohugo.io/t/checking-if-param-is-equal-template-parameter-inside-range/8398
**Category:** support
**Created:** [September 16, 2017, 10:30pm UTC](https://discourse.gohugo.io/t/checking-if-param-is-equal-template-parameter-inside-range/8398 "2017-09-16T22:30:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hcavalieri](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hcavalieri/32/4169_2.png) [@hcavalieri](https://discourse.gohugo.io/u/hcavalieri)
#### Post date: [September 16, 2017, 10:30pm UTC](https://discourse.gohugo.io/t/checking-if-param-is-equal-template-parameter-inside-range/8398/1 "2017-09-16T22:30:36Z")

</div>

# Thanks for stopping by 😃

* * *

So, I’m building a website that has a set of layout and style presets defined by the user in each page’s front matter. The way I control each preset is through an HTML class, following the **BEM** methodology. So, for example, the `hero` section with a “Hipster” style and a header is defined by

```auto
<section class="hero hero_Hipster hero_header">

```

In order to assign these classes relative to the .md file, I use a goLogic.html file with a “bem” function defined, using the snippet `{{ template "bem" (dict "context" . "class" "hero" "vibe" true "layout" "header")}}`. Inside the “bem” function I need to, if “layout” is set, loop through the pages .Params and find the “class” array and display the “layout” value if it’s set to true. I’ve tried many methods, the latest using a `range where` function, to no avail. Here’s how it looks rn:

```auto
  {{- $class := .class -}}
  {{- $layout := .layout -}}
  {{- $index := .context.Params -}}

  {{- if .layout }} {{ .class }}_
    {{- range where $index (print $class) true -}}
      {{$layout}}
    {{- end -}}
  {{- end -}}

```

The problem so far has been that `.context.Params` renders each sub array as `map[]` instead of `(name of the parameter)[]`. **Anyone with better knowledge on ranges that could help me out? 🙂**

### Reference - part of the .md file:

```auto
SEO:
  description: >-
    Nós entendemos do seu estilo! Venha fazer uma visita e vamos te deixar mais linda do que nunca!
  favicon: /images/logoDark.png
  image: /images/logoLight.png
  title: O melhor salão do Lourdes - Salão da Viki
hero:
  logo: true
  imageboolean: true
  header: true

```

(in this example, I want to cycle through `index.md` and return the template variable `layout` if `.Params.hero.header` is true)
