-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
What version of Hugo are you using (hugo version)?
Tested from 0.116.0 until 0.157.0, confirmed appeared in version 0.154.4;
Does this issue reproduce with the latest release?
yes
Description
When using uglyurl with defaultContentLanguage and defaultContentLanguageInSubdir, the page render engine create the redirect to the set default language in index.html as well as <defaultLanguage>/index.html while other languages render properly.
According to a test i've done, this started as of version 0.154.4. See this pastebin link for test results; you can see as of 0.154.4 (test starting at line 2457) that index.html and en/index.html are both the same md5 value vs fr/index.html has a different one.
I've ran this batch of test with en as default language, but re-running using fr as the default language produce the same result where for that run fr/index.html is the same hash as /index.html while /en/index.html is rendered correctly.
Relevant hugo.yml config file used in testing
baseURL: 'https://example.org/'
title: 'My New Hugo Project'
theme: testtheme
defaultContentLanguage: en
defaultContentLanguageInSubdir: true
languages:
en:
languageName: English
weight: 1
fr:
languageName: Français
weight: 2
uglyurls: true
disableKinds: ["RSS", "term", "taxonomy", "sitemap"]Content of /index.html and /en/index.html
<!doctype html>
<html lang="en">
<head>
<title>https://example.org/en/index.html</title>
<link rel="canonical" href="https://example.org/en/index.html">
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=https://example.org/en/index.html">
</head>
</html>Content of /fr/index.html
<!DOCTYPE html>
<html lang="fr" dir="ltr">
<head>
<meta name="generator" content="Hugo 0.154.4">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>My New Hugo Project</title>
<link rel="stylesheet" href="/css/main.min.73be4799b2091d293b47b52ca2642fe82aa2b1c9c050e8d1b389a80939a30dd4.css" integrity="sha256-c75HmbIJHSk7R7UsomQv6CqiscnAUOjRs4moCTmjDdQ=" crossorigin="anonymous">
<script src="/js/main.23cd0c7d837263b9eaeb96ee2d9ccfa2969daa3fa00fa1c1fe8701a9b87251a1.js" integrity="sha256-I80MfYNyY7nq65buLZzPopadqj+gD6HB/ocBqbhyUaE=" crossorigin="anonymous"></script>
</head>
<body>
<header>
<h1>My New Hugo Project</h1>
<nav>
<ul>
<li>
<a href="/en/index.html">Home</a>
</li>
<li>
<a href="/en/posts/index.html">Posts</a>
</li>
<li>
<a>Tags</a>
</li>
</ul>
</nav>
</header>
<main>
</main>
<footer>
<p>Copyright 2026. All rights reserved.</p>
</footer>
</body>
</html>