# Control Flow with \`include\`

**URL:** <https://talk.jekyllrb.com/t/control-flow-with-include/2803>\
**Category:** Help\
**Created:** [April 6, 2019, 10:06am UTC](https://talk.jekyllrb.com/t/control-flow-with-include/2803 "2019-04-06T10:06:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Royi](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/royi/32/1630_2.png) [@Royi](https://talk.jekyllrb.com/u/Royi)\
**Post date:** [April 6, 2019, 10:06am UTC](https://talk.jekyllrb.com/t/control-flow-with-include/2803/1 "2019-04-06T10:06:58Z")

</div>

Hello,

I’m trying to create a YouTube embedder using `include` as described in [Adding YouTube Embed Video Plugin](https://github.com/github/pages-gem/issues/609).

This is the `youtube-embedder.html` I craeted:

```auto
{% if include.class %}
	<iframe class="{{ include.class }}" width="{{ include.width }}" height="{{ include.height }}" src="https://www.youtube.com/embed/{{ include.id }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{% else %}
	<iframe width="{{ include.width }}" height="{{ include.height }}" src="https://www.youtube.com/embed/{{ include.id }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{% endif %}

```

Basically I want to enter the class if it is defined in the `include` and nothing if it is not.  
This is how I use it:

```auto
{% include youtube-embed.html id=tbUB7NWAtHw width=960 height=540 class="center-iframe" %}

```

Yet it doesn’t work.

What is wrong with the Control Flow I created?

---

<div class="post-metadata">

**Author:** ![Royi](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/royi/32/1630_2.png) [@Royi](https://talk.jekyllrb.com/u/Royi)\
**Post date:** [April 6, 2019, 12:43pm UTC](https://talk.jekyllrb.com/t/control-flow-with-include/2803/2 "2019-04-06T12:43:51Z")

</div>

I think I got it.  
The problem is `kramdown` parses this as MarkDown code.  
Hence the `Tab` I added before `<iframe...>` made it interpret it as a code.

By the way, should it be:

```auto
{% include youtube-embed.html id=tbUB7NWAtHw width=960 height=540 class="center-iframe" %}

```

Or

```auto
{% include youtube-embed.html id=tbUB7NWAtHw width=960 height=540 class=center-iframe %}

```

**Note** : Mind the missing `"` in the the `class=center-iframe` of the 2nd example.

Should I add `"`? Because it works only if I add `"` but then I don’t understand why it is not required for the `id` (If it is for strings) or the numerical values (I guess numerical values doesn’t need it)?

What are the rules?
