# Setting up layouts for nested section and its pages

**URL:** <https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833>\
**Category:** support\
**Created:** [April 10, 2023, 4:24am UTC](https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833 "2023-04-10T04:24:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hrishikesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hrishikesh/32/19176_2.png) [@Hrishikesh](https://discourse.gohugo.io/u/Hrishikesh)\
**Post date:** [April 10, 2023, 4:24am UTC](https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833/1 "2023-04-10T04:24:28Z")

</div>

This is not a duplicate of: [Setting a custom single layout for nested section](https://discourse.gohugo.io/t/41742) (or any other similar issue I could find)

**Reproduction:** [GitHub - Hrishikesh-K/hugo-43833](https://github.com/Hrishikesh-K/hugo-43833)

**Goal:**

For all content pages in the “work” section, I wish to have a base layout and then each page would separately have its specific content on it. So I want the inheriting something like:

```auto
layouts/_default/baseof.html
  - layouts/work/single-baseof.html
    - layouts/work/work-1-1.html

```

That’s how I thought it would work when I read base template for single pages, but for some reason, I seem to have it wrong.

**Result I’m getting:**

A 404 when I visit `/work/work-1/work-1-1/`.

**Alternatives considered:**

I could add conditional logic to `layouts/_default/baseof.html` to add the “common” stuff there, but would like to avoid it if possible.

**Additional notes:**

The problem doesn’t occur if I remove `single-baseof.html` and directly use `work-1-1.html` to inherit `baseof.html`.

What am I missing, or how can I achieve the above scenario?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 10, 2023, 4:24pm UTC](https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833/2 "2023-04-10T16:24:47Z")

</div>

A `baseof` template is at the top of the stack, regardless of where you have placed it. The next template down will be a section (list) or page (single). Or to put it another way, a `baseof` template cannot be called by another `baseof` template.

---

<div class="post-metadata">

**Author:** ![Hrishikesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hrishikesh/32/19176_2.png) [@Hrishikesh](https://discourse.gohugo.io/u/Hrishikesh)\
**Post date:** [April 10, 2023, 6:50pm UTC](https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833/3 "2023-04-10T18:50:04Z")

</div>

Oh, I saw [Layout lookup rules](https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-regular-pages) and by seeing a specific `baseof` (in this case `single-baseof`), I thought I could use it to extend. It’s probably a good suggestion to add that note to the docs.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [April 12, 2023, 6:50pm UTC](https://discourse.gohugo.io/t/setting-up-layouts-for-nested-section-and-its-pages/43833/4 "2023-04-12T18:50:33Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
