Excluding posts from a nested section?

I have a partial that should appear in all nested sections (e.g blog/foo/ with foo as the nested section). I want to run an if statement, hence, is cascading a front matter the only way to achieve this?

If this is your content…

content/
├── blog/
│   ├── 2023/
│   │   ├── _index.md
│   │   ├── blog-1.md
│   │   └── blog-2.md
│   ├── 2024/
│   │   ├── _index.md
│   │   ├── blog-3.md
│   │   └── blog-4.md
│   ├── _index.md
│   └── about-blog.md
├── films/
│   ├── action/
│   │   ├── _index.md
│   │   ├── film-1.md
│   │   └── film-2.md
│   ├── comedy/
│   │   ├── _index.md
│   │   ├── film-3.md
│   │   └── film-4.md
│   ├── _index.md
│   └── about-films.md
└── _index.md

…in which pages do you want to include the partial?