Forum
Using Chinese characters in the blog url
We host a second copy of perch that is entirely localized for China/Hong Kong. I was wondering if there was a way for the blog posts to use the Characters, or there Unicode equivilant, instead of the default conversion to a random string. While I'm not very learned on translation over the web, I feel like there is be an SEO benefit for our Chinese market.
Do you have the PHP Internationalization extension installed on your server?
Sorry for no reply, I've been on holiday.
I am enabling it now. Is the next step a rewrite for any of the blog url's? Or can it be done directly from perch?
Rewrite in what sense?
Using the .htaccess file to enable to use of Chinese characters and rewrite the URL.
what we are looking for is the URL to look like this"
Sure, you'd need to do that in your server config. Perch doesn't have URL rewriting - you need Perch Runway for that.
Ok, So I've done all the internationalization settings I can on the server. When I go to change the URL of the blog post to Chinese it comes out with the english characters, like this:
example.com.hk/blog/guo-tai-ji-gang-long-jian-xi-ji-shi-pei-xun-ji-hua
Will we need to upgrade to runway to get the desired outcome?
Is that the correct transliteration of the input?
Yeah, so the title of the post is
國泰及港龍見習機師培訓計劃
and I put that into the URL input and save the blog post, and it gets changed toguo-tai-ji-gang-long-jian-xi-ji-shi-pei-xun-ji-hua
when I hit save.Right, that's the designed behaviour. If you don't want that behaviour, use a text field rather than a slug field.
I created another text input in the template file
<perch:blog label="Chinese URL" id="chineseUrl" type="text" supress="true" />
and then changed the settings to/blog/{chineseUrl}
but it either comes up with a 404 message, or goes straight to the blog index. Using the arabic character URL still takes the user to the blog post. I've checked the server and it can server international domains fine.I'm a bit unsure about how the slug system is supposed to work. Should slug format be {postTitle}? Or something relating to the Chinese Url?
Are you then filtering the posts by your new field?