步骤 1:调整文章图片布局
首先你需要确保文章的图片位置为左侧布局。
打开主题配置文件,搜索封面顯示的位置。
1 2 3
   | # the position of cover in home page (封面顯示的位置)   # left/right/both   position: left
   | 
将 position 改为 left。
同时设置 hexo 的页面展示文章数首页文章数最好大于 20 篇。
目前已修复,不过最好多一点不然侧边栏会显得过长。
1 2 3 4 5 6 7 8
   | # Home page setting # path: Root path for your blogs index page. (default = '') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator:   path: ''   per_page: 20   order_by: -date
   | 
步骤 2:接入 CSS
打开”\themes\butterfly"路径下的”_config.yml”
搜索到”inject:”设置处
原生添加以下代码或下载 css 从本地导入:
1 2 3 4
   | inject:   head:     - <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-double-row-display@1.00/cardlistpost.css"/>   bottom:
   | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
   | #recent-posts{     margin-top:-1rem;       align-content:flex-start;     display: flex;     flex-wrap: wrap;      justify-content: space-between;  } #recent-posts > .recent-post-item {        margin-top: 1rem;    display: inline-block;   height:auto;    width:49%; } #recent-posts > .recent-post-item .post_cover {   width: 100%;      height: 200px; } #recent-posts > .recent-post-item .post_cover img.post_bg {   width: 100%;   height: 100%; }
 
  #recent-posts > .recent-post-item >.recent-post-info > .content { display:none; } #recent-posts > .recent-post-item {
    -webkit-flex-direction: column;    -ms-flex-direction: column;    flex-direction: column; 
  } #recent-posts > .recent-post-item .left_radius {     border-radius: 8px 8px 0 0; } #recent-posts > .recent-post-item .right_radius {     border-radius: 8px 8px 0 0; } .recent-post-item{     height:auto !important; }
  .recent-post-info {
    padding: 0 40px;   margin-top: 1em;   width: 100%!important; } #recent-posts > .recent-post-item > .recent-post-info > .article-title {     -webkit-line-clamp: 1;     margin-top: 0.3rem;      margin-bottom: 0.3rem;     color: var(--text-highlight-color);     font-size: 1.2em;      line-height: 1.4;
  } #recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap {     margin-bottom: 1rem; } @media screen and (max-width: 768px) { #recent-posts > .recent-post-item {  width:100%; }
  | 
链接进入后,你会发现,布局神奇地变成了双栏布局。
步骤 2:修改 pug
原生主题用户
如果你想让发布时间、分类、标签不在一行显示可以修改 pug。
打开”\themes\hexo-theme-butterfly\layout\includes\mixins\post-ui.pug”。
在__separator 和 i.fas 之间加上换行符 br。
1 2 3
   | span.article-meta__separator br i.fas.fa-tag.article-meta__icon
   | 
步骤 4:相关 BUG 解决
在 Android 大佬的指导下已完美解决文章不够时的样式问题,使用新的 cdn 链接即可。