Using Hugo’s Custom Taxonomies for Portfolio Projects

Hugo is a popular static site generator that offers a flexible way to organize content through custom taxonomies. For portfolio websites, custom taxonomies can help categorize projects, skills, or technologies, making it easier for visitors to browse and for you to manage content.

What Are Custom Taxonomies in Hugo?

Custom taxonomies in Hugo are a way to create additional categories beyond the default ones like tags and categories. They allow you to define your own classification systems tailored to your portfolio needs, such as project types, technologies, or client sectors.

Setting Up Custom Taxonomies

To create custom taxonomies, you need to modify your site’s config.toml or config.yaml file. Here’s an example using TOML:

taxonomies = {
  projectType = "projecttypes",
  technology = "technologies",
  clientSector = "clientsectors"
}

This configuration defines three custom taxonomies: projectType, technology, and clientSector. Each one will have its own URL path and archive pages.

Assigning Taxonomies to Portfolio Content

When creating a new portfolio project, you can assign taxonomy terms in the front matter. Here’s an example of a project post in Markdown:

+++
title = "E-Commerce Website"
date = "2024-04-27"
projectType = ["Website"]
technologies = ["Hugo", "JavaScript", "CSS"]
clientSectors = ["Retail"]
+++

This data links the project to specific categories, which will be reflected in your site’s taxonomy pages.

Displaying Taxonomies on Your Site

Hugo automatically generates taxonomy list pages if configured properly. To display all project types, add a link in your navigation or create a custom list page:

{{ range .Site.Taxonomies.projectType }}
  {{ .Term }}
{{ end }}

This code iterates over all project types and creates links to their archive pages, helping visitors filter projects by category.

Benefits of Using Custom Taxonomies

  • Organizes projects more effectively
  • Improves site navigation
  • Enhances SEO with structured URLs
  • Makes content management easier

By leveraging custom taxonomies, your portfolio site becomes more user-friendly and easier to maintain, providing a better experience for visitors and showcasing your work professionally.