# Universal Page layout for all pages in a Zola site

**URL:** <https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293>\
**Category:** Support\
**Created:** [April 27, 2022, 5:46pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293 "2022-04-27T17:46:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallcreek](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/smallcreek/32/728_2.png) [@smallcreek](https://zola.discourse.group/u/smallcreek)\
**Post date:** [April 27, 2022, 5:46pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293/1 "2022-04-27T17:46:02Z")

</div>

I’m using Zola to make a static website. All of the pages follow pretty much the exact same HTML layout no matter what section, so that means I’d only need 1 layout template.

However, I can’t seem to be able to do that since metadata is stored in different variables: if I want the title of the page, I have to use either `{{ section.title }}` or `{{ page.title }}` depending on whether I’m working with a section or a page.

This would mean I’d need to make two templates with the same HTML structure but with different variables, and I just really don’t want to do that because it would be repetition.

So, is it possible to have one, universal HTML layout for all pages? Does this conflict with how Zola is supposed to work somehow? I can’t tell; I’m coming from a Cobalt background, and Cobalt is an SSG that allows this stuff easily since there’s no distinction between `section.foo` and `page.foo` — it’s all `page.foo`.

---

<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:** [April 27, 2022, 7:27pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293/2 "2022-04-27T19:27:56Z")

</div>

So there is [Section vs Page](https://zola.discourse.group/t/section-vs-page/522) discussing that.  
It is kind of a toss between whether people like the distinction or not (I like it myself but I understand why some don’t).  
In the meantime you can do something like `{% set content = section or page %}` at the top and you can refer to `content` for the rest of the template.

---

<div class="post-metadata">

**Author:** ![smallcreek](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/smallcreek/32/728_2.png) [@smallcreek](https://zola.discourse.group/u/smallcreek)\
**Post date:** [April 27, 2022, 8:52pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293/3 "2022-04-27T20:52:18Z")

</div>

[This is my code](https://termbin.com/51zj), and it’s not working. I have `{% set any = section or page %}` at the top and I have referred to `any`, but it’s not working.

---

<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:** [April 28, 2022, 8:52pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293/4 "2022-04-28T20:52:34Z")

</div>

It looks like something like:

```auto
    {% if page %}
    {% set any = page %}
    {% endif %}
    {% if section %}
    {% set any = section %}
    {% endif %}

```

works. Not sure why `or` doesn’t work though

---

<div class="post-metadata">

**Author:** ![smallcreek](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/smallcreek/32/728_2.png) [@smallcreek](https://zola.discourse.group/u/smallcreek)\
**Post date:** [April 28, 2022, 11:30pm UTC](https://zola.discourse.group/t/universal-page-layout-for-all-pages-in-a-zola-site/1293/5 "2022-04-28T23:30:09Z")

</div>

Thanks you SO MUCH for the help! You rock!

This definitely looks like a hacky thing and I think that something like `any` should be implemented, but as long as it ain’t broke, I won’t fix it. `:)`

##### _P.S. I’m new to Discourse, how do you stop the message window from trying to convert emoticons into emoji?_
