Special characters in taxonomy

Hello !

I’m new to Hugo and I’m playing with it to see if it could replace my actual WordPress blog .

I managed to get all posts in Hugo, the same way they are on my blog (with the same URL, which is nice), but I have some problems. One of which involves taxonomies : as I’m writing in French, I need to support special characters, like é or à.

Without tweaking anything, Hugo just uses these characters in URL (for instance, http://blog.com/tags/entrée). What I’d like is the same behavior than WordPress : keep the name with all special characters for display, but use a special URL without them.

Is there a way to do so in Hugo ? Maybe I missed something in docs, but I have found nothing about this case.

By the way, I’m impressed with Hugo speed : with around 600 posts, and lots and lots of taxonomies, I can generate everything in less than a minute.

656 pages created
3210 paginator pages created
441 createurs created
47 sagas created
9 categories created
421 tags created
67 annees created
1177 acteurs created
in 47007 ms

If I can deal with all the minor issues I have, maybe I’ll switch… :slight_smile:

Thanks for your help !

No there is not a current workaround for your accented URLs. If you believe it should behave differently, open up an issue on GitHub.

I’m a little bit curious about your site, though. It’s very unusual in it’s distribution (more acteurs than pages etc.). I would expect it to run faster than 47 seconds, but maybe the pages are big?

Ok then, I’ll open an issue. I think it will be a common problem for every non-english users, so I guess it’s worth trying to fix.

As for my blog, I do a lot of movie review, and each actor is a taxonomy. So it’s no surprise I have more taxonomies than posts. But I imported the whole site, with around 1100 posts, and I have strange results. Sometimes, Hugo does everything in less than 30 seconds. Sometimes, it needs more than a minute, I don’t know why…

One thing to try is to delete the (rm -r) the public folder before rebuilding the site – see if that helps. There has been some reports (or: one if I remember: http://discuss.gohugo.io/t/why-is-hugo-slow-the-first-time-i-run-it-every-day-solved/797/23 ) that talks about synching issues with large number of files.

I’m not sure. Here’s what I tried :

  • First time (public folder empty) : 42911 ms
  • Second time (relaunching immediately, so folder full) : 26642 ms
  • Third time (after emptying the folder) : 38175 ms

It seems pretty random to me. But anyway, the numbers are so low that I really don’t care. :slight_smile:

As long as you are happy. Could be anything. If Windows I would check antivirus.

No, it’s OS X.

Before trying Hugo, I thought there was no way it could handle all my blog in less than 10 minutes. So you can imagine my surprise… :slight_smile:

OK, just shout if you have any questions.

(and if you’re willing to share the source somehow, I will gladly build it myself and see what takes time. I would expect more consistent build times < 20 seconds.)

If you want, no problem ! I will send you a PM with a link to download everything.

I have looked at your project. Out-of-the box on my i5 Ubuntu laptop I had to kill the process … My PC got unresponsive …

But then I notice you use a new feature in Hugo 0.14 that allows media (jpg, png etc) to live in the same folder as the content files.

By moving these files to /static (same folder structure):

0 draft content
0 future content 
1096 pages created
4618 paginator pages created
659 createurs created
56 sagas created
9 categories created
491 tags created
77 annees created
1513 acteurs created
in 7888 ms

Which is more in line with my expectations.

I have created this issue to follow up on this:

/cc @spf13

Oh right, I see… :smiley:

Well, I like the idea of keeping the media in the same folder as the content itself. And I don’t mind waiting, if that’s what it takes.

Up to you, but as moving the media files temporarily is just a few keystrokes away, this is what I would do:

  • Move all the historic media files to /static
  • Write all new content with content + media files in /content
  • When Hugo gets a better solution for this, copy all the historic media files back to /content

@nicolinuxfr the issue is fixed in the latest Hugo code base.

1 Like

Hello, I’m french too and am looking for the exact same thing : special characters in categories’ names not appearing in URLs.

Presently if I have a category named “présentement”, the slug for it is “présentement” instead of “presentement” (whereas other characters like the single quotes, for example, are removed, as wanted), how to fix it ?

I found it. Just have to put this line in the config file :
RemovePathAccents = true

For RemovePathAccents to work, PreserveTaxonomyNames must be omitted or set to false

PreserveTaxonomyNames = false