Slash pages in Hugo

In Hugo, creating different slash pages (like /about/, /uses/, etc.) involves creating specific content files for each page and customizing templates as needed.

  • Create individual markdown files for each slash page under content/.
    If you want to create an /about/ page in your blog, add a markdown page with below front matter in the content/ page.
//content/about.md

---
title: "About"
date: 2024-10-16
---

This is the About page content.
  • Optionally create a template for the page.
    Hugo uses the single.html template from the layouts/_default/ folder to render pages by default. However, you can create custom templates in the layouts/page/ folder to format specific pages as needed.
//layouts/page/about.html

<h1>{{ .Title }}</h1>
<div class="content">
  {{ .Content }}
</div>

You can check my slash pages like uses, credits, and changelog.

References

Hugo Docs

Read More