HUGO

How to share content between categories without duplicating the content?

Hey guys,

I’d like to know if exists a way to share content between categories without the necessity to replicate the content.

Example:

  • Category A
    – Content A

  • Category B
    – Content A

I’d like to share the same content between categories to keep easier the maintainability.

Leverage taxonomies.

content/post/content-a.md

+++
title = "Content A"
date = 2020-11-17T11:37:18-05:00
draft = false
categories = ["Category A","Category B"]
+++
Able was I ere I saw Elba.

Appreciate your answer, Joe.

I was reading the documentation and I have a doubt, using this approach the content will be reflected on the menu?

The menu is what you define as a menu. If you currently have a menu that automatically loads all the categories then show that code and we can help to modify it to show taxonomy pages. You will need to take care too of the display of taxonomy indexes by (probably just) copying the index page for the categories.