Learn how to create a new Hugo project from scratch using the Hugo command-line tool. See the generated files and get recommendations for a text editor to use for the project.
- [Narrator] Okay, now we're ready to create a new Hugo project. Open up the terminal or shell on your computer, I'll use PowerShell again and then navigate to the place where you want to store your site files. I'm going to stay here in my documents folder. Then I'll run Hugo new site and provide a name for the new project. I'm going to call this awesome static site. This command creates a new folder called awesome static site and that folder has a number of files inside.
I'll CD into that folder by starting to type the name and then just hitting tab to finish it. If I list the contents of this folder, I'll see a number of files and the number of folders inside. What I want to do next is open up this folder in my favorite text editor or code editor. I'll use Visual Studio code, but you can use Atom, Sublime, Notepad or whatever you're comfortable editing text files in. If you don't have a favorite editor, you can try downloading Visual Studio code at code.visualstudio.com. It works really well for editing these types of files.
Right now the content folder is empty. Hugo created the scaffolding and the structure of the site, but there's not content, themes, or templates here yet. This a good point to initialize a Git repository for this project. I'll switch back to PowerShell and I can run Git in it and get status to see the untracked files. Then I can run Git add dash, dash all and then Git commit with a commit message like create initial project.
I'm using sign commit, so I need to enter a passphrase, but if you're using Git for the first time you probably won't have to do this. This will check all the scaffolding into Git and get us ready for the next step. Now we need to add a theme and some content to the site.
- How static sites work
- Advantages of static sites
- Tools for building static sites
- Installing Hugo and Git
- Creating a new Hugo site
- Building a website
- Setting up a deployment pipeline
- Deploying and testing a site