---
title: "Fixing Up Japanese Language Tags"
date: 2025-01-07T13:33:20-08:00
description: Updating Japanese language tag slugs to make them easier to navigate.
tags:
  - Meta
  - Hugo
  - japanese
  - japan
---

Two years ago, I took a trip to Japan with {{< tess >}}. I wrote up my experiences on
that trip in various posts, and shared several photos.

Feeling perhaps overly-confident in my ability to read Japanese and my website
engine's ability to handle non-ASCII content, I tagged many of those pages with
Japanese language tags:
[日本]({{< ref "/tags/japan" >}}),
[日本語]({{< ref "/tags/japanese" >}}),
[東京]({{< ref "/tags/japan-tokyo" >}}),
[京都]({{< ref "/tags/japan-kyoto" >}}).

This led to some unweildy URLs because of how Hugo rendered the Japanese
language tags names into ASCII when generating file paths.

```html
<ul>
    <li><a href="/tags/nature/">Nature</a></li>
    <li><a href="/tags/temples/">Temples</a></li>
    <li><a href="/tags/%E6%97%A5%E6%9C%AC/">日本</a></li>
</ul>
```

It's not necessary to convert URLs to punycode if your document is UTF8, but
Hugo does it. Browsers should automatically handle converting to and from
punycode when sending HTTP requests over the wire. Nevertheless...

I went through my post tags and updated all of the Japanese language tags to
have English slugs and Japanese titles. Now, these URLs are more friendly for
typing (and the file paths are easier to navigate in a terminal) while still
showing up in posts and tag list pages with the Japanese name.

```html
<ul>
    <li><a href="/tags/meta/">Meta</a></li>
    <li><a href="/tags/hugo/">Hugo</a></li>
    <li><a href="/tags/japanese/">日本語</a></li>
</ul>
```


## One More Thing

I often tag posts with tags by location. For example, several of my posts from
my Japan trip in 2023 are tagged with `/tags/japan` and with (e.g.)
`/tags/tokyo`. For the place tags that are within a large region, like cities
within countries, I added the larger region to the tag:

* `/tags/tokyo` → `/tags/japan-tokyo`
* `/tags/kyoto` → `/tags/japan-kyoto`

I only did this for the Japan tags for now. I'll be making more such updates
going forward.
