# Test whether page variable in \[extra\] not found

**URL:** <https://zola.discourse.group/t/test-whether-page-variable-in-extra-not-found/2036>\
**Category:** Support\
**Created:** [January 29, 2024, 9:44pm UTC](https://zola.discourse.group/t/test-whether-page-variable-in-extra-not-found/2036 "2024-01-29T21:44:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 29, 2024, 9:44pm UTC](https://zola.discourse.group/t/test-whether-page-variable-in-extra-not-found/2036/1 "2024-01-29T21:44:35Z")

</div>

i use a control variable to determine the layout in a page.  
similar to the following

> {%if page.extra.layout == “top” %}

i test whether the variable exists using the following

> {%if page.extra.layout and page.extra.layout == “top” %}

how to test whether a variable is not found.

along the lines of

> {%if page.extra.layout == null %}

which fails.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [January 30, 2024, 11:57am UTC](https://zola.discourse.group/t/test-whether-page-variable-in-extra-not-found/2036/2 "2024-01-30T11:57:44Z")

</div>

You can try `{%if page.extra.layout is defined %}` if it’s not set at all in the extra

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 30, 2024, 5:17pm UTC](https://zola.discourse.group/t/test-whether-page-variable-in-extra-not-found/2036/3 "2024-01-30T17:17:21Z")

</div>

or …

`{%if page.extra.layout is not defined %}`

thanks appreciate it
