Hugo Tags - How to Change Tag Slug / Url (if different from Tag name / text)?

I understand this amounts to asking too much of a static website generator, but I have a real-life situation that would like this feature / possibility (if it exists in Hugo).

Is it possible to change the slug for a tag? Here’s an example of what I am asking.

I am migrating my site from wordpress to hugo. In 1 of my posts, The tag is Square’s Privacy Issues and the url-slug for that tag is square-app-privacy

Wordpress allows you to edit the tag slugs, and since it is database driven, I can see how easy that was to implement in that CMS.

Can I do something similar in Hugo? :stuck_out_tongue_winking_eye:

This become especially important in cases where a “belongs to” word gets pluralized.

Ex: Square’s Privacy tag slug becomes squares-privacy and J-Lo’s tag slug becomes j-los :slightly_smiling:

1 Like

Pages have a slug config option, but if it really is tags (aka taxonomy in Hug) you are talking about, then currently no.

There are plans making this happen, but it will take some time.

Until then you might get closer to what you want by:

preservetaxonomynames: true
``

In the site configuration.

Yes, I am talking about tag urls / tag-slugs.

I just saw the documentation for preservetaxonomynames: true in this commit.

I understand it for most part. Like you said, the preservetaxonomynames: true works on normalizing the urls.

I was wondering how I get to this documentation from the command line?

Thank you!
-Shiva

About this taxonomy terms slugs, I have one more question. The referenced commit states, that when preserveTaxonomyNames is set to false , “Gérard Depardieu” will become Gerard Depardieu when listed on listing pages.

My question is about slugs themselves. With this setting untouched (so by default I assume FALSE), the slug should become gerard-depardieu but it is actually gérard-depardieu with an accent.

So my tags and categories have accents in their slugs. Anyway to avoid this?

Thanks,
Jérémy

And yes, I’m french :slightly_smiling:

The proper fix for this is related to an issue that is labeled “Nodes vs Page” or something, that is in the pipeline.

The current workaround/hack is to keep a mapping of term and name/description/whatever in a map in a data file.

Ok, thanks for the info, I’ll manage my slugs this way until the issue is resolved.

A post was split to a new topic: I need slugs for tags