Ugly mixed with pretty URLs

Is there a way to mix the Ugly urls with the pretty URL feature on the same site? Meaning, I have some pages like so:

And other URLs like so:

Essentially, anything that was original written in WordPress with the default clean URL left alone has no extension, but anything where the extension was manually set has one. As a temporary solution, I’ve rewritten Hugo’s output with a bash script, but I’m wondering if there’s a way to do this with Hugo itself.

The alias functionality maybe?.

I believe that maybe the url field in the front matter may not respect the “uglyUrls” setting and accept whatever the user provides.

I believe the way it works is:

If Ugly URLs is on, then Hugo respects anything you put in URL with an extension. But, if you input “new-post” then hugo creates the URL as post-post.html. This seems like a bug, maybe?

With Ugly URLs off, then Hugo respects what you put into the URL field except that it truncates anything with an extension on it.

Ideally, I’d like hugo to just use what I put in the url front mater on a post. It’s not a hard thing to fix with Bash or a Gulp rename. I just thought it was strange enough to warrant asking about.

Is there a way to do this now in 2020? I would like to know this also. My regular pages are with .html extension and I would like to keep it that way for SEO reasons.

But I would like my pagination pages and category pages to be without the .html extension. becomes and becomes

But the rest of the pages should have .html.

Is this possible now?


Have you tried any of the suggestions in this thread?