next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.43k stars 429 forks source link

求助:如何修改文章计数的样式 #798

Closed gapplef closed 1 month ago

gapplef commented 4 months ago

Issue Checklist

Other Information

请问怎样能将文章计数的样式改回旧版,需要修改什么部分?新版的对我而言太突兀、不和谐了。 Untitled

welcome[bot] commented 4 months ago

Thanks for opening this issue, maintainers will get back to you as soon as possible!

stevenjoezhang commented 4 months ago

可以修改这个地方: https://github.com/next-theme/hexo-theme-next/blob/524c3693f21b7fd3d3ee75e7e614afe7217a0d7e/source/css/_common/components/pages/categories.styl#L22

gapplef commented 4 months ago

感谢,我参考代码的修改记录用以下代码恢复了原版

  .category-list-item {
    margin: 5px 10px;
  }

  .category-list-count {

    color: $grey;

    &::before {
      content: ' (';
    }

    &::after {
      content: ') ';
    }
    font-size: $font-size-base;
  }

请问如果要在_data下修改,是需要添加什么?

gapplef commented 4 months ago

不清楚是否是最佳选择,不过在_data/styles.styl中加入以下代码实现了修改

.category-all-page .category-list-count {
    badge() {all: unset;}
    badge()

    color: $grey;

    &::before {
      content: ' (';
    }

    &::after {
      content: ') ';
    }
    font-size: $font-size-base;
    /*badge();*/
}
sghuang19 commented 1 month ago

@gapplef 使用 injection 是非常好的选择,这正是 Hexo + NexT 的强大之处!祝你使用愉快!