mmistakes / minimal-mistakes

:triangular_ruler: Jekyll theme for building a personal site, blog, project documentation, or portfolio.
https://mmistakes.github.io/minimal-mistakes/
MIT License
12.48k stars 25.74k forks source link

Staticman-v2 doesn't show up in the topic if the topic is Chinese character #1438

Closed yuanqingfei closed 5 years ago

yuanqingfei commented 6 years ago

Environment informations


Expected behavior

I have tested the comments with staticman v2 on one of my post with english as title. it works like here: https://yuanqingfei.me/Hello-World/. However, if the URL contains Chinese character, I can see the comments have been inserted into my repository correctly. But these comments just cannot show up in the UI for any other Chinese title post.

Steps to reproduce the behavior

just need try post for any Chinese title post. it will not show up but it do show up for my first post.

mmistakes commented 6 years ago

Please provide a link to a public repo with the issue.

The way the comments are brought in is when a comment is approved Staticman creates data files under _data/comments in a folder that matches the post's slug. I'll need to verify what it's creating and what your post slug is. If they don't match... no comments on the page.

For example your Hello World post work's because the comment data file folder is /_data/comments/Hello-World and the post's slug is Hello-World.

yuanqingfei commented 6 years ago

Thanks for quick response. I have seen your test in my repository.

https://github.com/yuanqingfei/yuanqingfei.github.io/blob/master/_data/comments/%E7%A7%BB%E6%B0%91%E5%8A%A0%E6%8B%BF%E5%A4%A7-1/entry1514909217040.yml

_id: f4c1a260-efd6-11e7-847a-f738a8b9adad message: Test name: Tester email: b642b4217b34b1e8d3bd915fc65c4452 url: '' hidden: '' date: 1514909217

yuanqingfei commented 6 years ago

but I cannot see your comments in my website. https://yuanqingfei.me/immigration/%E7%A7%BB%E6%B0%91%E5%8A%A0%E6%8B%BF%E5%A4%A7-1

mmistakes commented 6 years ago

The the post slug might need to be escaped in the Staticman form code as the url looks to be that way. That's why the comment isn't showing up, one has the Chinese characters, the other is using the escaped HTML.

I'll have to do some testing.

mmistakes commented 6 years ago

There might be something else at play. I tried cloning your repo and building it locally and all the Chinese title posts don't work. The characters are messed up and clicking any of the links go to 404 pages.

image

The only link that works is the English title... "Hello World". There may be a Jekyll setting for this but I'm unfamiliar with it as I only ever write content in English.

yuanqingfei commented 6 years ago

The reason is that your computer(Windows or Linux) have not install Chinese Language Pack....

In my opinion, this should be caused by comments cannot be mapped by 'Unicoded Character'. That is to say, it doesn't support UTF-8 for this level.

yuanqingfei commented 6 years ago

screenshot from 2018-01-02 21-34-05

it looks like this in my local machine.

mmistakes commented 6 years ago

That makes sense. In that case not sure if I’m going to be much help at solving this issue.

Hard to tell what’s at fault here:

yuanqingfei commented 6 years ago

In fact, there are also 2 other places doesn't support Unicode, one is the search function which only search english. the other is read time calculation. Of course, all these are not necessarily caused by your theme, maybe just caused by 3-rd plugin or Jekyll. Anyway, Thanks a lot for your great work for such a great theme! thanks again!.

WizKidd42 commented 6 years ago

Bug

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity.

If this is a bug and you can still reproduce this error on the master branch, please reply with any additional information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in 7 days if no further activity occurs. Thank you for all your contributions.

VincentTam commented 5 years ago

@yuanqingfei Here's a blog article that proposed a modification of the template code to solve this problem. You're right that that's a problem with Jekyll's slug. The author of the article suggests using site.data.comments[page.uuid] instead to solve this problem.

Reference: 使用Statiman给博客提供评论功能(二)