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

换行符导致首页展示异常的问题 #47

Open
tangx opened this issue Dec 5, 2017 · 9 comments
Open

换行符导致首页展示异常的问题 #47

tangx opened this issue Dec 5, 2017 · 9 comments

Comments

@tangx
Copy link

tangx commented Dec 5, 2017

最近换到 Win10 WSL 下,提交文章后发现一个换行符因此的问题。

windows 换行符会引发首页展示异常

  1. 正常情况下,摘要显示文章第一样内容。
  2. 由 Windows 换行符引发异常后,展示结果如下。
    image
@mzlogin
Copy link
Owner

mzlogin commented Dec 5, 2017

你好~感谢反馈,目前在你的博客上没有看到现象,请问你是否已经找到解决方案?如果暂无方案的话,可否提供一份出问题的示例文件用作排查呢?

@tangx
Copy link
Author

tangx commented Dec 12, 2017

http://mzblog.octowhale.com
https://github.com/octowhale/mzblog_test

你好,不好意思回复晚了。
我重新还原了一个出问题的 repo ,如上述的两个链接。
希望对你有所帮助

====

其实也不算解决方案(我也不懂web)。我就只是将 _post 目录下的所有文章, 用 dos2unix 命令,将 windows 换行符换成了 unix 换行符。问题就解决了。

@mzlogin
Copy link
Owner

mzlogin commented Dec 12, 2017

好的,非常感谢,我抽空看一下看能否在配置上规避这个问题~

@maotongxue
Copy link

我也遇到这个问题,好像博主并没有引用md上的description,还是摘要显示文章第一样内容。是不是要是引用了description,就可以规避这么问题?

@mzlogin
Copy link
Owner

mzlogin commented Dec 27, 2017

@maotongxue 用 description 可以规避。我因为是在 Windows 下安装 git 的时候都是选的 push 的时候自动转为 unix 换行符,所以没遇到过,其它系统理论上没有这个问题。

@maotongxue
Copy link

好像你的blog没有引用description,我也添加了description,首页没有生效。
image
image

@mzlogin
Copy link
Owner

mzlogin commented Dec 27, 2017

@maotongxue 现在首页展示的不是 description,是从文章内容里截取的。

如果想使用 description,可以将 index.html 文件的第 42 行的 post.excerpt 修改为 post.description

@maotongxue
Copy link

好的,十分感谢您的项目和解答。

@mzlogin
Copy link
Owner

mzlogin commented Dec 27, 2017

@maotongxue 不客气~

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

3 participants