In this video, Nate demonstrates how to add a post to the site using Hugo. Nate also covers how Hugo handles draft content and how to preview drafts using Hugo server.
- [Instructor] Like everything else with Hugo, adding new content to a Hugo site starts in the terminal. Inside of my project folder, I can run Hugo, new post, forward slash hello dash world dot md. This creates a new file, which I can see in my editor in the content folder, post-sub folder, and finally, hello dash world dot md, the file I just created. The file name, hello dash world, becomes the URL of the new post and it typically follows the title of the post.
md stands for Markdown, which is the language you'll use to add formatting to your posts and pages. If you're not familiar with Markdown you can visit markdowntutorial.com to get a quick lesson. I'll go ahead and edit the title of this post a little bit and then add some content. Now let's run the Hugo server again to preview the site with this new post. I'll save this file and then in my terminal run Hugo server. When I open up a browser and go to local host the new post does not show up.
This isn't a bug. The reason the new post didn't show up is because it's marked as a draft. You can see this at the top of the new file, draft equals true. Drafts let you work on posts and preview posts before they go live on your site. This whole section at the top of the file is called front matter and I'll explain more about it in a bit. For now, we're not going to change anything here. Instead, in my terminal, I'm going to cancel the Hugo server with control C and then run Hugo server again, but this time with the dash D flag.
Dash D here tells Hugo to render the drafts as well. So now when I go to the browser and refresh I'll see the new post that I created. Next I'll take a closer look at the front matter section at the top of the file.
- Advantages of static sites
- Installing Hugo and Git
- Creating a new Hugo site
- Building a new website
- Adding posts, pages, and static content
- Publishing your static site
- Deploying via FTP, AWS, and Netlify
Skill Level Beginner
AWS: Storage and Data Managementwith Brandon Rich4h 25m Intermediate
1. How Static Sites Work
2. Set Up Hugo
3. Build a Website
4. Prepare for Publishing
5. Deploy via FTP
6. Deploy to AWS
7. Deploy with Netlify
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.