Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Validation Failed #118

Closed
DanielJyc opened this issue Feb 8, 2018 · 7 comments
Closed

Error: Validation Failed #118

DanielJyc opened this issue Feb 8, 2018 · 7 comments

Comments

@DanielJyc
Copy link

初始化页面评论页报错Error: Validation Failed.
原因:如下图评论的标签,及第二个字段id/2018/02/04/shell%E8%84%9A%E6%9C%AC%E4%BD%BF%E7%94%A8%E5%92%8C%E6%80%BB%E7%BB%93/太长导致。请问下,这个怎么解决。在这里可以重现Link

image

@zphj1987
Copy link

http://xichen.pub/2018/01/31/2018-01-31-gitment/

@vimcaw
Copy link

vimcaw commented Feb 10, 2018

我的也是,Console:
api.github.com/repos/vimcaw/blog/issues
Failed to load resource: the server responded with a status of 422 (Unprocessable Entity)

@iHTCboy
Copy link

iHTCboy commented Feb 25, 2018

出现 Error:validation failed

我想到一个更好的方法,用文章的时间,这样长度是保证在50个字符内,完美解决!
id: '<%= page.date %>'

具体原因可以查看我博客:http://ihtc.cc/2018/02/25/2018-02-25%20_Gitment评论功能接入踩坑教程/

@DanielJyc
Copy link
Author

使用 @iHTCboy 的方法,更好一些。:+1:

我用的next-reloaded主题。修改文件next-reloaded/layout/_third-party/comments/gitment.swig下:

    {% if page.comments %}
      <script type="text/javascript">
      function renderGitment(){
        var gitment = new {{CommentsClass}}({
            id: '{{ page.date }}',
            owner: '{{ theme.gitment.github_user }}',
            repo: '{{ theme.gitment.github_repo }}',
            {% if theme.gitment.mint %}
            lang: "{{ theme.gitment.language }}" || navigator.language || navigator.systemLanguage || navigator.userLanguage,

中修改id: '{{ page.date }}',就可以了。

@chenzunyin
Copy link

@iHTCboy good job

@huiwang
Copy link

huiwang commented Apr 4, 2018

我觉得用题目更好点 id: '{{ page.title }}' 比如https://github.com/huiwang/gitment.hui-wang.info/issues

ReionChan pushed a commit to ReionChan/reionchan.github.io that referenced this issue Jun 4, 2018
@Sogrey
Copy link

Sogrey commented Jan 5, 2020

记录,我也遇到,但是我的问题不是label字符超过50个,而是标题中包含了英文半角的, 可以改成中文逗号,希望有帮到后来人。

Sogrey/Sogrey.github.io#28 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants