# Permalink to subsections in config

**URL:** <https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826>\
**Category:** support\
**Created:** [January 3, 2018, 9:48pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826 "2018-01-03T21:48:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amb85](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@amb85](https://discourse.gohugo.io/u/amb85)\
**Post date:** [January 3, 2018, 9:48pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/1 "2018-01-03T21:48:16Z")

</div>

Is it possible to configure permalinks for items in a section and subsections in the config?

I have `content/pages/about.md` and `content/pages/policies/several-pages.md`.

I want to access these at `/about/` and `/policies/some-page/` and `/policies/some-other-page/`.

In the config, under `[permalinks]`, I have `pages = "/:title/"` which gives me `/about/`. If I change that to `pages = /:section(s)/:title/`, I end up with `pages` in the URL again. Also, use of `:sections` builds `pages/some-page` and not `pages/policies/some-page` as I would expect.

Is it possible to either exclude the section files directly under `pages` but include it for subsections or to do something like `pages/about = "/about/"` and `pages/policies` = `/policies/:title`?

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [January 3, 2018, 10:03pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/2 "2018-01-03T22:03:12Z")

</div>

> [@amb85](#):
>
> Is it possible to either exclude the section files directly under pages but include it for subsections or to do something like pages/about = “/about/” and pages/policies = /policies/:title?

No. Permalinks configuration is section wide. Using the forward slash like that in your config will throw an error and your site will not be generated at all.

But there are hacks circulating in the forum about configuring section URLs and excluding the section-name. Use the search button for those.

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [January 3, 2018, 10:04pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/3 "2018-01-03T22:04:06Z")

</div>

I believe that currently all pages in the section use the same permalink pattern.

I’d get the pattern you want working with sub-paths, and then override pages at the top-level in their front matter. So in `/pages/about.md` set `url = "about"`.

---

<div class="post-metadata">

**Author:** ![amb85](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@amb85](https://discourse.gohugo.io/u/amb85)\
**Post date:** [January 3, 2018, 10:08pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/4 "2018-01-03T22:08:09Z")

</div>

> [@alexandros](#):
>
> No. Permalinks configuration is section wide. Using the forward slash like that in your config will throw an error and your site will not be generated at all.

Yep, I found that out. Was wondering if there was an alternative solution. I’ll go take a look and see what else I can find as I hadn’t managed to find any hacks.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 3, 2018, 10:54pm UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/5 "2018-01-03T22:54:41Z")

</div>

Note that

```bash
/:sections/:title/

```

Is a valid permalink pattern and will give you what you think it does. But that was probably not what was asked for. It is not possible to say `/:sections[1]/:title/` or whatever.

---

<div class="post-metadata">

**Author:** ![tiotolstoy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tiotolstoy/32/11226_2.png) [@tiotolstoy](https://discourse.gohugo.io/u/tiotolstoy)\
**Post date:** [April 30, 2020, 12:36am UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/6 "2020-04-30T00:36:13Z")

</div>

I cannot seem to find these “hacks” please help. I am attempting the same thing as OP.

I made a post here: [Second level nesting for permalink config](https://discourse.gohugo.io/t/second-level-nesting-for-permalink-config/25138)

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [April 30, 2020, 6:08am UTC](https://discourse.gohugo.io/t/permalink-to-subsections-in-config/9826/7 "2020-04-30T06:08:33Z")

</div>

Archived on April 30, 2020, 6:08am UTC


