blog: Fixing Up Japanese Language Tags
Finish it. Publish.
This commit is contained in:
parent
741163dac8
commit
fd890b7486
1 changed files with 42 additions and 6 deletions
|
@ -1,14 +1,15 @@
|
|||
---
|
||||
title: "Fixing Up Japanese Language Tags"
|
||||
date: 2025-01-07T13:33:20-08:00
|
||||
draft: true
|
||||
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
|
||||
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
|
||||
|
@ -19,9 +20,44 @@ Japanese language tags:
|
|||
[東京]({{< ref "/tags/japan-tokyo" >}}),
|
||||
[京都]({{< ref "/tags/japan-kyoto" >}}).
|
||||
|
||||
This led to some difficult URLs because of how Hugo rendered the Japanese
|
||||
This led to some unweildy URLs because of how Hugo rendered the Japanese
|
||||
language tags names into ASCII when generating file paths.
|
||||
|
||||
It's always bothered me a bit to have paths that look like this, so I went
|
||||
through today and updated those tags to have ASCII slugs, and Japanese titles. I
|
||||
went a step further
|
||||
```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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue