New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
force flag for hugo new (not hugo new site) #9243
Comments
Yes, a way to overwrite existing files with |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We already have
--force
forhugo new site
but it seems this flag is not available forhugo new
to create content.I have looked at all the issues there and I can not see any relevant issue or PR:
https://github.com/gohugoio/hugo/search?p=15&q=force&type=issues
I have the following usecase:
A specific content type as template.
ENV_VAR=value hugo new my-new-file-name -k my-template-type
to populate the frontmatter with custom keys and values and create the new file.But if I want to update the content in a specific environment I want to run
ENV_VAR=other-value hugo new my-new-file-name -k my-template-type
to recreate it for compilation.And if my template-file changes, then I want to just run it with the old
ENV_VAR=value hugo new my-new-file-name -k my-template-type
but get the new template in the resulting file.Currently this does not work as Hugo says "file-name already exists".
Even the
--force
option for sites does not overwrite files but only folders. See https://github.com/gohugoio/hugo/blob/master/commands/new_site.go#L89 (seems to only add new files but not overwrite existing files).Maybe such an option to overwrite files should be added for the site command too.
My current workaround is to do a
rm file-name
and then runENV_VAR=other-value hugo new my-new-file-name -k my-template-type
again.The text was updated successfully, but these errors were encountered: