custom categoryBar

This commit is contained in:
biss committed 2025-08-14 16:15:18 +08:00
1 parent b0a4ee340b
commit 2c9440b16a
8 files changed
+114 -4

No files matched your search

@@ -0,0 +1,10 @@
.category-bar-items#category-bar-items(class=is_home() ? 'home' : '')
.category-bar-item(class=is_home() ? 'select' : '', id="category-bar-home")
a(href=url_for('/'))= __('博客首页')
each item in site.categories.find({ parent: { $exists: false } }).data
.category-bar-item(class=select ? (select === item.name ? 'select' : '') : '', id=item.name)
a(href=url_for(item.path))= item.name
.category-bar-item
a(href=url_for('/archives/'))= __('文章存档')
div.category-bar-right
a.category-bar-more(href=url_for('/categories/'))= __('更多分类')
@@ -2,6 +2,8 @@ mixin indexPostUI()
- const indexLayout = theme.index_layout
- const masonryLayoutClass = (indexLayout === 6 || indexLayout === 7) ? 'masonry' : ''
#recent-posts.recent-posts.nc(class=masonryLayoutClass)
#category-bar.category-bar
include ../categoryBar.pug
.recent-post-items
each article, index in page.posts.data
.recent-post-item
@@ -0,0 +1,56 @@
#category-bar
padding 7px 11px
background var(--card-bg)
border-radius 8px
display flex
white-space nowrap
overflow hidden
transition 0.3s
height 50px
width 100%
justify-content space-between
user-select none
align-items center
margin-bottom 20px
.category-bar-right
display flex
border-radius 8px
align-items center
.category-bar-more
margin-left 4px
margin-right 4px
font-weight 700
border-radius 8px
padding 0 8px
.category-bar-items
width 100%
white-space nowrap
overflow-x scroll
scrollbar-width: none
-ms-overflow-style: none
overflow-y hidden
display flex
border-radius 8px
align-items center
height 30px
&::-webkit-scrollbar
display: none
.category-bar-item
a
padding .1rem .5rem
margin-right 6px
font-weight 700
border-radius 8px
display flex
align-items center
height 30px
&.select
a
background #3eb8be
color var(--btn-color)
Loaded 3 of 8 files, more files were not shown because too many files have changed in this diff. Show more