# Uglyurls from a content adapter

**URL:** <https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231>\
**Category:** support\
**Tags:** content-adapters\
**Created:** [January 22, 2025, 3:07pm UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231 "2025-01-22T15:07:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveH](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daveh/32/23776_2.png) [@DaveH](https://discourse.gohugo.io/u/DaveH)\
**Post date:** [January 22, 2025, 3:07pm UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/1 "2025-01-22T15:07:58Z")

</div>

Hello - Loving content adapters! Many thanks for this feature.

I have `uglyURLs = true` set in my `hugo.toml` file, which is working on all files except those generated by a content adapter.

Those generated by the content adapter follow the pretty url pattern: `file-name/index.html`, where as I need to end up with `file-name.html`.

Is there a way to make sure this flag is respected by the adapter? Or have I missed something here? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 22, 2025, 5:07pm UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/2 "2025-01-22T17:07:50Z")

</div>

I’m on hugo v0.140.1 and for me that works fine (also with v0.126.0 where that was introduced)

looks like you have something wrong in your code which you would have to share for help.

#### Try it out:

```auto
hugo new theme --themesDir . adapter
cd adapter

```

- set `uglyURLS = true` in hugo toml

- create content adapter in `/content/posts/_content.gotpl`

- `hugo` will create `/public/posts/post-4.html`

---

<div class="post-metadata">

**Author:** ![DaveH](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daveh/32/23776_2.png) [@DaveH](https://discourse.gohugo.io/u/DaveH)\
**Post date:** [January 23, 2025, 8:26am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/3 "2025-01-23T08:26:08Z")

</div>

Thanks for the advice - much appreciated.

The screenshot below shows the configs and output from the qa config:

 ![CleanShot 2025-01-23 at 08.18.32@2x](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/8/7/873aec2874cab671aacaa053e4b9f7dcc9f4a66c.png)

I think this is the key bit from the content adapter as it stands right now

```go
  {{ $clinicianBio := dict }}
  {{ $brochureClinicianBioCMS := printf "%s/%s/%s" $base_url $api $v }}
  {{ with resources.GetRemote $brochureClinicianBioCMS }}
    {{ with .Err }}
      {{ errorf "Unable to get remote resource %s" $brochureClinicianBioCMS }}
    {{ else }}
      {{ $clinicianBio = . | transform.Unmarshal }}
      {{ $content := dict "mediaType" "text/markdown" "value" $clinicianBio.content }}
      {{ $page := dict
        "content" $content
        "kind" "page"
        "path" $clinicianBio.path
        "slug" $clinicianBio.path
        "url" $clinicianBio.url
        "title" $clinicianBio.title
        "params" $clinicianBio.params
        "layout" "clinician-bio/single"
      }}
      {{ $.AddPage $page }}

```

The code above is in a range which is why I can set $clinicianBio to the dot. I am on Hugo version 0.138.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 23, 2025, 8:39am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/4 "2025-01-23T08:39:52Z")

</div>

thx for sharing some code, but it does not make sense to setup something, that might be exactly yours.

you have a reproducible failure. please provide a runnable repo so we can really check what’s going on.

you have site setup around, remote data…

---

<div class="post-metadata">

**Author:** ![DaveH](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daveh/32/23776_2.png) [@DaveH](https://discourse.gohugo.io/u/DaveH)\
**Post date:** [January 23, 2025, 9:06am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/5 "2025-01-23T09:06:31Z")

</div>

OK thanks. I can’t really do share the repo as it’s a private repo for work. I will have a think and see if I can get to the bottom of it. Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 23, 2025, 10:17am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/6 "2025-01-23T10:17:35Z")

</div>

have you tried to set the default to true? if all your builds use true that does not make sense to me.

#### Hints

- print down the values of these directly after assigning a value to them - maybe you can identify something special for the wrongly generated pages there.

- you use these

---

<div class="post-metadata">

**Author:** ![DaveH](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daveh/32/23776_2.png) [@DaveH](https://discourse.gohugo.io/u/DaveH)\
**Post date:** [January 23, 2025, 11:29am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/7 "2025-01-23T11:29:56Z")

</div>

> [@irkode](#):
>
> `"url" $clinicianBio.url`

I removed the above and that seems to have fixed the problem!! 😊

I have tried different values, and even an empty string, and any value seems to cause the problem.

I don’t understand Hugo well enough to understand what or why this should be.

Many thanks for your help with this. It’s really appreciated.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [January 23, 2025, 11:32am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/8 "2025-01-23T11:32:49Z")

</div>

have look here: [URL management | Hugo](https://gohugo.io/content-management/urls/#slug)

> If you set both `slug` and `url` in front matter, the `url` value takes precedence.

sounds like it is never a good idea to set both 🙂

---

<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:** [January 25, 2025, 11:32am UTC](https://discourse.gohugo.io/t/uglyurls-from-a-content-adapter/53231/9 "2025-01-25T11:32:55Z")

</div>

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