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

首页布局错误 #223

Open
imkerberos opened this issue Feb 27, 2017 · 25 comments
Open

首页布局错误 #223

imkerberos opened this issue Feb 27, 2017 · 25 comments

Comments

@imkerberos
Copy link

首页博客数量不足一页时布局错误, 边栏在列表下方.
期望: 边栏在列表右侧.

@wudanyang6
Copy link

我也有这个问题, 我是通过 org-mode 转成了 html, 程序截取的时候会带着 html 标签截取, 我直接将那段截取的模板代码修改成如下所示:

        .post-content
          != post.content.substring(0, 0)

@tufu9441
Copy link
Owner

tufu9441 commented Apr 3, 2017

我在Hexo根目录下的_config.yml中把每一页显示的文章数设置为1,并没有出现这个问题啊?

# Pagination
## Set per_page to 0 to disable pagination
per_page: 1
pagination_dir: page

@thiswan
Copy link

thiswan commented Apr 12, 2017

恩,是这个问题,感谢博主这么晚了还给解答!
刚试了下,设置per_page 的值为<= 6时能正常显示。页容量超过6条就样式显示错位,我之前一直默认用的都是10条没这个问题。求解答,3Q...

@tufu9441
Copy link
Owner

我设置的是8一直没有出现过问题,我翻了一下改动历史,有可能是PR #125 的时候引入的问题,但是具体有什么区别其实我也不知道……你可以对比一下代码看看。

@thiswan
Copy link

thiswan commented Apr 12, 2017

好的,感谢!我怀疑是不是跟首页中.content_container元素的高度有关呢?我之前也没这个问题,这昨天更新完才出现的。

@tufu9441
Copy link
Owner

那你更新前是哪个版本?如果可能的话可以对比一下我改了哪里……

@tufu9441
Copy link
Owner

或者你先试一下还原一下我刚才说的那个pr。

@thiswan
Copy link

thiswan commented Apr 12, 2017

👍👍👍回退到PR #125问题解决了。

@tufu9441
Copy link
Owner

好的,那知道问题所在了,我再看着解决一下。

@thiswan
Copy link

thiswan commented Apr 12, 2017

👌 谢谢博主,早点歇了吧。

@tufu9441
Copy link
Owner

@justinchuby I need your help~

@justinchuby
Copy link

@tufu9441 我在尝试搞清楚问题的原因。
@thiswan 请问是回退到了 #125 之前(还原了 #125 的更改),还是刚好回退到 #125
@imkerberos 请问网页显示的分辨率是多少?
#125 的更改是使得边栏在网页宽度窄的时候显示到页面底部,以往则是不显示。

@thiswan
Copy link

thiswan commented Apr 13, 2017

@justinchuby 刚好退回到#125就显示正常了。

@justinchuby
Copy link

justinchuby commented Apr 14, 2017

刚好退回到#125就显示正常,说明问题就应该不是 #125 导致的。可以检查一下较新的PR。
不过我快速看了一下之后的commits,暂时还没有发现问题。

@tufu9441
Copy link
Owner

嗯,说得对,那应该不是 #125 的问题了

@gnohz
Copy link

gnohz commented May 28, 2017

好像光是改现实文章数量不能解决问题。
我用org写blog,然后用hexo-renderer-org渲染,没有问题。但是如果我用org加list来添加子标题,就会出现上面的问题,所有原来右边栏都到最底下了。

@liuhengloveyou
Copy link

liuhengloveyou commented Oct 13, 2017

这问题现在是怎么解决的?

我反复测试了几次。 发现改per_page解决不了这问题。
但是有个现象, 不知道有没有帮助:
有一个md文件加进去,格式就会乱掉。拿掉就好了。

这md文件我也看不出有什么特别的。。。难道是table比较多的原因? @tufu9441 你可以看一下, 希望有帮助:https://www.sixianed.com/2017/10/13/nginx-proxy-%E6%94%AF%E6%8C%81flv%E6%B5%81%E5%BC%8F%E6%92%AD%E6%94%BE/

@tufu9441
Copy link
Owner

一直没搞清是什么原因,最近也没有人报告过这种状况……

@lanceliao
Copy link

@tufu9441 我也出现了同样的问题,per_page 设置为10首页侧边栏跑到底部去了,其他页面显示正常。根据 @thiswan 的提示,设置成<=8之后显示正常(他的是<=6)。

@capsbon
Copy link

capsbon commented May 4, 2018

我的正好相反,设置为6时显示错误,设置为10正常

@wing-ho
Copy link

wing-ho commented Sep 30, 2018

我也有这个问题, 我是通过 org-mode 转成了 html, 程序截取的时候会带着 html 标签截取, 我直接将那段截取的模板代码修改成如下所示:

        .post-content
          != post.content.substring(0, 0)
diff --git a/layout/index.pug b/layout/index.pug
index 1042e08..8beb541 100644
--- a/layout/index.pug
+++ b/layout/index.pug
@@ -27,20 +27,14 @@ block content
         .post-content
           != post.excerpt
       else if post.content
-        - var br = 0
-        - for (var i = 0; i < 5; ++i) {
-          - br = post.content.indexOf('\n',br+1)
-          if br<0
-            - break
-          if br >150
-            - break
-        - }
+        - var start = post.content.indexOf('<p>')
+        - br = post.content.indexOf('</p>',start)
         if br < 0
           .post-content
             != post.content
         else
           .post-content
-            != post.content.substring(0, br)
+            != post.content.substring(start, br+4)
       p(class='readmore')
         a(href=url_for(post.path))= __('Readmore')

我也是用Org Mode来写博客的,我改为截取第一对<p></p>之间的内容,首页布局就正常了。

@xeh1430
Copy link

xeh1430 commented Mar 22, 2019

问题:边栏在列表下方
操作:我在 hexo _config.yml 配置文件中将归档页设置为不分页 archive: 1
原因:主题 maupassant 归档页 maupassant/layout/archive.pug 代码中嵌套分页代码,造成冲突
解决:打开 archive.pug 代码,注释掉 include _partial/paginator.pug 这段代码,位置在最后一行

@tufu9441
Copy link
Owner

@xeh1430 他们之前一直是首页的问题,不是归档页面。

@xeh1430
Copy link

xeh1430 commented Apr 21, 2019

@ xeh1430他们之前一直是首页的问题,不是归档页面。

@tufu9441 我是因为设置归档页为不分页,才造成边栏在列表下方的问题,边栏样式都是共用的,所以我归档页出问题,首页也会出问题,用到边栏样式的页面都会出现这种情况

@rainvalley
Copy link

边栏渲染在下方,per_page设置<=2时渲染正常。托管于GitHub Pages,控制台无Error,Warn。

tufu9441 added a commit that referenced this issue Sep 23, 2022
fix: #520,#223,修复首页文章展示异常
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