# Support a :sectionslug permalink token

**URL:** <https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005>\
**Category:** feature\
**Created:** [June 6, 2025, 4:51pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005 "2025-06-06T16:51:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![torabisu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/torabisu/32/24700_2.png) [@torabisu](https://discourse.gohugo.io/u/torabisu)\
**Post date:** [June 6, 2025, 4:51pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/1 "2025-06-06T16:51:28Z")

</div>

The URL path elements in a published Hugo site typically mirror the directory and file names of the content hierarchy within the `content/` directory, however, this is not always desirable. There are legitimate reasons for wanting these structures to differ.

It is easy to modify the final filename element of the URL using the `slug` front matter parameter but it is not possible to modify the naming of individual sections in a similar way.

We propose adding a `:sectionslug` permalink token (similar in priniciple to the existing [`:sections`](https://gohugo.io/configuration/permalinks/#sections) token) that modifies a section’s URL path element by using the `slug` or `title` parameters as defined in a section’s front matter (in `_index.md` file) iteratively to create the URL path, resulting in a slugified path

> **NOTE** : The [`url`](https://gohugo.io/content-management/urls/#url) field in the front matter can currently be used to override the entire path. This approach becomes error prone when handling nested content section hierarchies as care must be taken to propagate any changes to a section’s `url` to its subsections.

## Example

Given the content structure:

```auto
content/                           
└── 01-parent-section/
     ├── _index.md # slug: my-parent-section-slug ; title: "My Parent Section Title"
     ├── 01-article.md			
     └── 02-child-section/
         ├── _index.md # title: "My Child Section"
         └── 01-nested-article.md # title: "My Nested Article"

```

And the following permalink configuration using the proposed `:sectionslug` token:

```auto
# config.yaml
...
permalinks:
  page: 
    01-parent-section: /:sectionslug/:slug
  section:
	01-parent-section: /:sectionslug/:slug

```

The published site structure would be:

```auto
public/                           
└── my-parent-section-slug/
   ├── index.html   
   └── my-child-section/ 
       ├── index.html
       └── my-nested-article/ 
           └── index.html

```

We have already written and tested the code for this on multiple Hugo sites, and can make it available on request.

---

<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:** [June 6, 2025, 4:58pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/2 "2025-06-06T16:58:16Z")

</div>

I haven’t thought this through… it sounds like you have. Can you think of any scenarios where you _wouldn’t_ want this behavior? I’m not suggesting changing the current behavior… just thinking out loud.

Also, wouldn’t we want symmetry?

| Existing | New |
| --- | --- |
| `:section` | `:sectionslug` |
| `:sections` | `:sectionsslug` (not a great name, maybe `sectionslugs` instead) |

---

<div class="post-metadata">

**Author:** ![torabisu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/torabisu/32/24700_2.png) [@torabisu](https://discourse.gohugo.io/u/torabisu)\
**Post date:** [June 6, 2025, 7:30pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/3 "2025-06-06T19:30:16Z")

</div>

I like your recommendation on symmetry, makes its more cleaner. I prefer `sectionslugs` over `sectionsslug`. It’s easy to read and say 🙂

I cannot think of any scenarios where you wouldn’t want this behavior while explicitly adding the permalink token to your config file.

The only implication I can see implementing this, is a possible performance hit on very very deep hierarchies.

---

<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:** [June 6, 2025, 7:46pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/4 "2025-06-06T19:46:31Z")

</div>

This is a good idea. Please create a [proposal](https://github.com/gohugoio/hugo) and cross reference this forum topic. Thanks.

---

<div class="post-metadata">

**Author:** ![torabisu](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/torabisu/32/24700_2.png) [@torabisu](https://discourse.gohugo.io/u/torabisu)\
**Post date:** [June 6, 2025, 8:04pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/5 "2025-06-06T20:04:23Z")

</div>

Thanks for the feedback, I’ll get onto the proposal.

---

<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:** [June 6, 2025, 9:49pm UTC](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/6 "2025-06-06T21:49:54Z")

</div>

> <https://github.com/gohugoio/hugo/issues/13788>
>
> The URL path elements in a published Hugo site typically mirror the directory an…d file names of the content hierarchy within the \`content/\` directory, however, this is not always desirable. There are legitimate reasons for wanting these structures to differ. 
> 
> It is easy to modify the final filename element of the URL using the \`slug\` front matter parameter but it is not possible to modify the naming of individual sections in a similar way. 
> 
> We propose adding a \`:sectionslugs\` permalink token (similar in priniciple to the existing \[\`:sections\`\](https://gohugo.io/configuration/permalinks/#sections) token) that modifies a section's URL path element by using the \`slug\` or \`title\` parameters as defined in a section's front matter (in \`\_index.md\` file) iteratively to create the URL path, resulting in a slugified path
> 
> \> \*\*NOTE\*\*: The \[\`url\`\](https://gohugo.io/content-management/urls/#url) field in the front matter can currently be used to override the entire path. This approach becomes error prone when handling nested content section hierarchies as care must be taken to propagate any changes to a section's \`url\` to its subsections. 
> 
> \## Example
> 
> Given the content structure:
> 
> \`\`\`
> content/                           
> └── 01-parent-section/
> ├── \_index.md # slug: my-parent-section-slug ; title: "My Parent Section Title"
> ├── 01-article.md			
> └── 02-child-section/
> ├── \_index.md # title: "My Child Section"
> └── 01-nested-article.md # title: "My Nested Article"
> \`\`\`
> 
> And the following permalink configuration using the proposed \`:sectionslugs\` token:
> 
> \`\`\`
> \# config.yaml
> ...
> permalinks:
> page: 
> 01-parent-section: /:sectionslugs/:slug
> section:
> 01-parent-section: /:sectionslugs/:slug
> \`\`\`
> 
> The published site structure would be:
> 
> \`\`\`
> public/                           
> └── my-parent-section-slug/
> ├── index.html   
> └── my-child-section/ 
> ├── index.html
> └── my-nested-article/ 
> └── index.html
> \`\`\`
> 
> We have already written and tested the code for this on multiple Hugo sites, and can make it available on request.
> 
> See the forum discussion \[here\](https://discourse.gohugo.io/t/support-a-sectionslug-permalink-token/55005/3)
