Aliases for items within a category?

I am rebuilding my very slow old WordPress website in Hugo. As a music composer, I sell music scores. Due to a limitation in the WordPress site, despite my taxonomy page (using Hugo’s parlance) being /compositions, the scores were at /product/[Title]. In the Hugo site I’m building, these are now correctly /compositions and /composition/[Title], which is what I’d wanted all along.

I know that I can define aliases in the frontmatter for each individual score so that /product/[Title] will redirect to /composition/[Title], but is there a way to do this at a site-wide level? I’d really love to define this once, rather than needing to define essentially the same exact thing in so many separate files.

I searched to see if anyone else had asked about this, but the only one I could find about this specific need was from 8 years ago and the functionality was not yet available. Has that changed?

One possibility is to provide a redirect directive in you web server’s configuration. Provided that you want to redirect all these /product/Title pages to /compositions/Titel.

1 Like

You can also create these redirects in a _redirects file if you plan to use static webhosts like Cloudflare Pages and Netlify. But the above solution is much better if you are using a normal webhost.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.