Skip to content

commands: Make cleanDestinationDir work even when staticDir doesn't exist #8433

@Kzer-Za

Description

@Kzer-Za

hugo v0.81.0+extended linux/amd64 BuildDate=unknown

Specifically, it seems to be ignored if you have never used this option from CLI. After installing Hugo I just put cleanDestinationDir: true in config.yaml of the site I'm trying to make. However, the command hugo never deleted any directories or files that were becoming obsolete. For example, I first built the site with the default taxonomies, but later decided that I didn't need them, so I disabled them with

disableKinds:
- taxonomy
- term

However, after running hugo the directories "tags" and "categories" were still in "public". The same was the case with obsolete files/directories in "content". Only after I have commented the option cleanDestinationDir: true in the config.yaml and ran hugo --cleanDestinationDir from the command line did Hugo build the "public" directory without the obsolete files/directories.

After that, to test the issue, I uncommented the line in the config and ran just hugo. But now the option in config is working and the obsolete files are deleted from "public" as they should. It's like something has been initialized by running hugo --cleanDestinationDir once.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions