Hugo refuses to detect .md files in 0.121.x - Only works when renaming file while running

Opened this issue:

Basically, since hugo 0.121.X Hugo is not detecting more than 1 content .md file.

Building dosent work and the only way to make hugo detect the files is to rename file(s) while hugo server is running, livereload then detects the change and the page shows.

However this means the site is impossible to build the site. As livereload isent running while building obviosly…

Anyone encountered the same issue?
(sorry for bad english btw, writing in a hurry)

Have you tested with different projects and, for example, a blank one? If you want some help please share a reproducible example. (I don’t have such a problem with hugo 121.1+extended on Linux.)

Yep, different projects, a blank one after just creating a new site with “hugo new site”.

default config, empty md files, i have triee everything…

Borh on windows and ubuntu.

Om windows it works SOME times, but it skips parts of the page randomly?

On ubuntu it dosent find any md files. Except the one for the startpage.

Whats interesting tho is if i take that file, i can rename it to whatever and use whatever layout file i want with it. But if i copy the contents of that file, and add it to another md file both in /content
It dosent work.

It also does not render the hugo.stats.json correctly.

Its not the files or projekt, if i try to build a backups from a few weeks ago or even from before sunday when i updated. It cant find those md file either.

Look at the github link to the issue i created, i have a more detaild description about my setup there.

It could also be that its an incompatability with another software or tool.

As i tried reinstalling ubuntu the ubuntu install is completly fresh.

Ive aldo tried using toml,yaml, json for frontmatter and config

What i use:
Ubuntu 22.04 installed the “minimal install”
Fish terminal

Hugo 0.121.1
Go 1.21.5
Nginx 1.25
Node.js using the fish nvm plugin
Postcss latest from npm
Java - dont remember the v, just using it for g closure compiler

Editor vscode
Vscode plugins:
A theme
Hugo synthax highlighter
Alpine.js intellisense
The standard go plugins that vscode autoinstalled when opening my go project.
Tailwind css intellisense(not using tw in hugo)
Htmx intellisense - disabled
SSH remote from ms

Non standard vscode settings:
zoom level
a few color changes

Edit: as it dosent work on a fresh install and hugo new site, it dosent matter if i give an example.

Btw ive also tried:
Specifying the content dir in the config, using both mount and contentDir.

Using all kind of flags when running “hugo”

Put broken markdown,html,yaml in the md files that SHOULD throw an error if hugo tries to parse it. But nothing… Until i rename the file and livereload detects it.

Permissions is set to 777 for all files and folders in the project directories.

On win i was using node 18, on ubuntu node 21.

Worth to mention:
On windows, both hugo 0.121 and 0.120 glitched explorer.exe when hugo server was running.
And some times i got weird issues where it lost the config file. The last one i got on 0.19 too

I have no idea what is your problem. I recommend to you to install various other versions of Hugo: if you meet the same issue, perhaps it’s not about Hugo. Why do you specify your Node version? And how do you install Hugo (on Linux the recommended way is from the .deb file from GitHub)?

I solved the issue, but i dident find out exactly what the issue was…

One of the files in the file system was “bad” in some way.

I removed all files , added them back, and made a command shortcut to remove .cache/hugo_cache, the projects resources folder, and the public folder, and when done running hugo --gc, then checking the public folder. And had nginx serving the public folder the entire time.

Then i manually deleted the files one by one by one and waited to see if it did anything.

It turned out the only file that worked in the beginning made hugo stop parsing without giving any errors or showing anything in logs.

Removed the file, and all pages rendered. Restored the file from a backup from yesterday, and hugo only found that file. Still no errors. Nothing in logs.

Checked for invisible characters etc but found nothing, the size was about the same, i only checked in kb, so couldve been a few bytes more or less.

It was the md file for the start page,

If i copied the contents of the file using any editor, vs code, neovim, mc, nano, gedit, to a NEW .md file. It worked.
If i saved the original file empty, opened it again, and pasted the original content, the same paste that worked when pasting into a new md file, hugo once again only found that file, and sometimes not even that.

I made a new dir on desktop, and tried it mulitple times and the issue was the same.

Whats interesting is that when livereload picked up a name change hugo found it. Probably because it then had a file and path to parse. So the issue seems to be with how hugo looks for files.

But either way, its solved,

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