The home page

In Hugo vocabulary, “posts” is a called a section. Lucid theme only considers content under this section as blog posts.

Any content that is under the content/posts directory, including sub-directories will be considered a blog post. ONLY this content will be shown on the home page as blog posts.

The following content will be considered as “posts” for your blog and will be listed on the home page:

  • content/posts/hello.md
  • content/posts/world/index.md
  • content/posts/woodworking/chair.md

Create a post

The following command creates a post for you to start writing.

hugo new posts/hello.md

The post will be accessible at example.com/posts/hello

Create a post under a subsection

The following creates a post under the “postgres” sub-section.

hugo new posts/postgres/array-length.md

This post will be available at example.com/posts/postgres/array-length

Refer to “Section options” below to know more about options supported for displaying section content in their own pages.

Organize content in other sections

For any content other than posts, feel free to create pages under different sections. These pages are not considered blog posts and are not listed on the home page.

Examples below:

  • content/pages/about.md
  • content/projects/lucid.md

Example command to create content under another section

hugo new projects/hello.md
  • The example page created above would be available at example.com/projects/hello
  • Any content under content/projects would be listed under example.com/projects. They are listed just like posts on the home page.

The Lucid Docs page is an example of a section page. The theme supports a few options for section pages. Read on.

Any content under content/posts or it’s subdirectories will appear on the RSS feed of your blog. Content from other sections are considered “pages” and will not appear in the RSS feed.

Section options

All the options mentioned below are used on the theme’s documentation section page.

The section page for the docs is at content/lucid-docs/_index.md in my blog’s website. This special _index.md page under a section is meant for adding all the options for the section page.

The frontmatter of the page has the following options set:

title: "Lucid theme for Hugo documentation"
sortorder: "asc"
paginate: 100

Due to these options:

  • The page has a title.
  • The sort order of posts is ascending (oldest first). Good for documentation, guides, etc.
  • Pagination is set to 100 - I want all the posts to be listed on the same page.

Add a section intro

If you want your projects section to have a title and an introduction, then create a file at the following location

content/projects/_index.md

Add a title and content to the _index.md file to create a section intro. Below is the section intro for the Lucid theme’s documentation page.

---
title: "Lucid theme for Hugo documentation"
---

This section has all you need to get a Hugo blog up and running with the [Lucid theme](/lucid-theme).

Pagination for section pages

Let us say you create a section and want to override the default pagination limit. Add paginate: 100 to the section frontmatter in the _index.md file.

Both the pagination is used in the docs page. If you notice the default pagination on my blog at define.run is actually 5 posts per page.

Sort order of posts

If your section is meant for a guide or ebook or any kind of content that requires the oldest post to be listed first, then use the sortorder: "asc" option in the frontmatter of the section.