# Section vs Page

**URL:** <https://zola.discourse.group/t/section-vs-page/522>\
**Category:** Uncategorized\
**Created:** [July 29, 2020, 4:26pm UTC](https://zola.discourse.group/t/section-vs-page/522 "2020-07-29T16:26:00Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![drmason13](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/drmason13/32/444_2.png) [@drmason13](https://zola.discourse.group/u/drmason13)\
**Post date:** [February 23, 2021, 5:48pm UTC](https://zola.discourse.group/t/section-vs-page/522/8 "2021-02-23T17:48:45Z")

</div>

Hello, I’ve read this while looking for a way to get the section variables of the section a page is in.  
For me this seems like a benefit of having pages belong to a section.

My simple use case is to have the `{{ section.title }}` included in the `<title>` element. So far it seems that a page simply forgets about its section. I see that there is `get_section()`, but it is a bit inconvenient to run it on every page!

While drafting this, I found the `page.components` variable has what I need. 🙂

I found this trick useful for exploring what variables existed. In the template of a page:

```auto
{% set section = get_section(path="my_section/_index.md", metadata_only=true) %}

<h2>section vars</h2>
{% for key,value in section %}
<code>{{ key }} = {{ value }}</code><br>
{% endfor %}
            
<h2>page vars</h2>
{% for key,value in page %}
<code>{{ key }} = {{ value }}</code><br>
{% endfor %}

```

example output:

### section vars

```auto
relative_path = blog/_index.md
content =
permalink = http://127.0.0.1:1111/blog/
ancestors = [_index.md]
title = List of blog posts
description =
extra = [object]
path = /blog/
components = [blog]
toc = []
word_count = 0
reading_time = 0
lang = en
assets = []
pages = []
subsections = []
translations = []

```

### page vars

```auto
relative_path = blog/2021-02-23-my-blog-page.md
content = <p>Foo</p>
permalink = http://127.0.0.1:1111/blog/my-blog-page/
slug = my-blog-page
ancestors = [_index.md, blog/_index.md]
title = My blog page
description =
updated =
date = 2021-02-23
year = 2021
month = 2
day = 23
taxonomies = [object]
extra = [object]
path = /blog/my-blog-page/
components = [blog, my-blog-page]
summary =
toc = []
word_count = 1
reading_time = 1
assets = []
draft = true
lang = en
lighter =
heavier =
earlier = [object]
later =
translations = []

```

---

_[View the full topic](https://zola.discourse.group/t/section-vs-page/522)._
