Forrest logo
back to the hugo tool

hugo:tldr:27e85

hugo: Create a new page.
$ hugo new ${section_name}/${page_name}
try on your machine

This command is used in the Hugo static site generator to create a new content file based on a predefined archetype. Here's how each part of the command works:

  • hugo new: This is the command itself, indicating that you want to create a new piece of content.
  • ${section_name}: This is a placeholder for the name of the section or content type in which you want to create the new page. It could be something like blog, post, news, etc. You would replace ${section_name} with the actual name of the desired section or content type.
  • /: This is a forward slash that separates the section name from the page name.
  • ${page_name}: This is a placeholder for the desired name of the new page. It can be any string without spaces. You would replace ${page_name} with the actual name you want to give to the new page.

For example, if you want to create a new blog post, you can use the command: hugo new blog/my-new-post.

Hugo will generate a new content file, usually in Markdown format, with a filename based on the provided section name and page name. You can then edit and customize the generated content file as needed.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hugo tool