I rename content/ports meet error

I rename content/ports to content/blog
then index page is blank

then I rename content/blog to content/ports
index page also is blank

my command is: mv content/ports content/blog

Hi, are you talking about the case when previewing site with hugo serve? Sometimes you would need to restart the process when moving folders or files.

If the index page is blank during actual build without moving the dir, you might have a template issue. Please see the related documentation and ensure your index page template is in one of the places mentioned there.

Otherwise we would need more information, like link to the repo, and a more detailed description of the problem you’re facing

ok, I reboot my PC, now all page is display again.
hugo is not clean cache function?
this issue: old cache maybe update.

hugo server keeps the pages in memory, if not specified otherwise, and doesn’t regenerate everything during rebuilds (removed pages might remain, for example). You can always just restart it if you do something funny like move/rename some big content folders. For me it’s not an issue in practice.

You shouldn’t encounter this issue during normal builds, but I myself still add --cleanDestinationDir flag to ensure no old files from previous builds remain.

must use old name, and reboot PC

how to rename content/posts to another name

You shouldn’t need to reboot PC, just stop the hugo server command and start it again

Please note that if you rename content/posts to another name, the Section of the content changes.

So if you rename content/posts to content/blog, hugo might use the template layouts/blog/list.html now, whereas before it might have been layouts/posts/list.html. See hugo layout lookup order for details.

your are right. I will study Section next.