mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 15:10:37 +00:00
feature: 剥离主题目录
This commit is contained in:
32
themes/NEXT/TagLayout.js
Normal file
32
themes/NEXT/TagLayout.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import BaseLayout from './BaseLayout'
|
||||
import StickyBar from './components/StickyBar'
|
||||
import TagList from './components/TagList'
|
||||
import BlogPostListScroll from './components/BlogPostListScroll'
|
||||
|
||||
const TagLayout = ({ tags, posts, tag, categories, postCount, latestPosts }) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
const meta = {
|
||||
title: `${tag} | ${locale.COMMON.TAGS} | ${BLOG.title}`,
|
||||
description: BLOG.description,
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
// 将当前选中的标签置顶🔝
|
||||
if (!tags) tags = []
|
||||
const currentTag = tags?.find(r => r?.name === tag)
|
||||
const newTags = currentTag ? [currentTag].concat(tags.filter(r => r?.name !== tag)) : tags.filter(r => r?.name !== tag)
|
||||
|
||||
return <BaseLayout meta={meta} tags={tags} currentTag={tag} categories={categories} postCount={postCount} latestPosts={latestPosts}>
|
||||
<StickyBar>
|
||||
<TagList tags={newTags} currentTag={tag}/>
|
||||
</StickyBar>
|
||||
<div className='md:mt-8'>
|
||||
<BlogPostListScroll posts={posts} tags={tags} currentTag={tag}/>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
}
|
||||
|
||||
export default TagLayout
|
||||
Reference in New Issue
Block a user