slug 调整兼容已有主题

This commit is contained in:
tangly1024.com
2024-05-08 16:22:14 +08:00
parent 65eff434ec
commit 9b78eb499c
56 changed files with 1318 additions and 826 deletions

View File

@@ -15,19 +15,19 @@ const MenuGroupCard = props => {
const links = [
{
name: locale.COMMON.ARTICLE,
to: '/archive',
href: '/archive',
slot: archiveSlot,
show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG)
},
{
name: locale.COMMON.CATEGORY,
to: '/category',
href: '/category',
slot: categorySlot,
show: siteConfig('HEXO_MENU_CATEGORY', null, CONFIG)
},
{
name: locale.COMMON.TAGS,
to: '/tag',
href: '/tag',
slot: tagSlot,
show: siteConfig('HEXO_MENU_TAG', null, CONFIG)
}
@@ -47,9 +47,9 @@ const MenuGroupCard = props => {
if (link.show) {
return (
<Link
key={`${link.to}`}
title={link.to}
href={link.to}
key={`${link.href}`}
title={link.href}
href={link.href}
target={link?.target}
className={
'py-1.5 my-1 px-2 duration-300 text-base justify-center items-center cursor-pointer'

View File

@@ -33,7 +33,7 @@ export const MenuItemCollapse = props => {
onClick={toggleShow}>
{!hasSubMenu && (
<Link
href={link?.to}
href={link?.href}
target={link?.target}
className=' font-extralight flex justify-between pl-2 pr-4 dark:text-gray-200 no-underline tracking-widest pb-1'>
<span className=' transition-all items-center duration-200'>
@@ -64,7 +64,7 @@ export const MenuItemCollapse = props => {
<div
key={index}
className='dark:hover:bg-indigo-500 hover:bg-indigo-500 hover:text-white dark:bg-black dark:text-gray-200 text-left px-10 justify-start bg-gray-50 tracking-widest transition-all duration-200 py-3 pr-6'>
<Link href={sLink.to} target={link?.target}>
<Link href={sLink.href} target={link?.target}>
<span className='text-sm ml-4 whitespace-nowrap'>
{link?.icon && <i className={sLink.icon + ' mr-2'} />}{' '}
{sLink.title}

View File

@@ -19,7 +19,7 @@ export const MenuItemDrop = ({ link }) => {
onMouseOut={() => changeShow(false)}>
{!hasSubMenu && (
<Link
href={link?.to}
href={link?.href}
target={link?.target}
className=' menu-link pl-2 pr-4 no-underline tracking-widest pb-1'>
{link?.icon && <i className={link?.icon} />} {link?.name}
@@ -47,7 +47,7 @@ export const MenuItemDrop = ({ link }) => {
<li
key={index}
className='cursor-pointer hover:bg-indigo-500 hover:text-white tracking-widest transition-all duration-200 dark:border-gray-800 py-1 pr-6 pl-3'>
<Link href={sLink.to} target={link?.target}>
<Link href={sLink.href} target={link?.target}>
<span className='text-sm text-nowrap font-extralight'>
{link?.icon && <i className={sLink?.icon}> &nbsp; </i>}
{sLink.title}

View File

@@ -15,25 +15,25 @@ export const MenuListSide = props => {
{
icon: 'fas fa-archive',
name: locale.NAV.ARCHIVE,
to: '/archive',
href: '/archive',
show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG)
},
{
icon: 'fas fa-search',
name: locale.NAV.SEARCH,
to: '/search',
href: '/search',
show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG)
},
{
icon: 'fas fa-folder',
name: locale.COMMON.CATEGORY,
to: '/category',
href: '/category',
show: siteConfig('HEXO_MENU_CATEGORY', null, CONFIG)
},
{
icon: 'fas fa-tag',
name: locale.COMMON.TAGS,
to: '/tag',
href: '/tag',
show: siteConfig('HEXO_MENU_TAG', null, CONFIG)
}
]

View File

@@ -1,18 +1,36 @@
import { siteConfig } from '@/lib/config'
import { useGlobal } from '@/lib/global'
import CONFIG from '../config'
import { siteConfig } from '@/lib/config'
import { MenuItemDrop } from './MenuItemDrop'
export const MenuListTop = (props) => {
export const MenuListTop = props => {
const { customNav, customMenu } = props
const { locale } = useGlobal()
let links = [
{ id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: siteConfig('HEXO_MENU_INDEX', null, CONFIG) },
{ id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG) },
{ id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG) }
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MENU_CATEGORY', null, CONFIG) },
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MENU_TAG', null, CONFIG) }
{
id: 1,
icon: 'fa-solid fa-house',
name: locale.NAV.INDEX,
href: '/',
show: siteConfig('HEXO_MENU_INDEX', null, CONFIG)
},
{
id: 2,
icon: 'fas fa-search',
name: locale.NAV.SEARCH,
href: '/search',
show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG)
},
{
id: 3,
icon: 'fas fa-archive',
name: locale.NAV.ARCHIVE,
href: '/archive',
show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG)
}
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, href: '/category', show: siteConfig('MENU_CATEGORY', null, CONFIG) },
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, href: '/tag', show: siteConfig('MENU_TAG', null, CONFIG) }
]
if (customNav) {
@@ -34,9 +52,16 @@ export const MenuListTop = (props) => {
return null
}
return (<>
<nav id='nav-mobile' className='leading-8 justify-center font-light w-full flex'>
{links?.map((link, index) => link && link.show && <MenuItemDrop key={index} link={link} />)}
</nav>
</>)
return (
<>
<nav
id='nav-mobile'
className='leading-8 justify-center font-light w-full flex'>
{links?.map(
(link, index) =>
link && link.show && <MenuItemDrop key={index} link={link} />
)}
</nav>
</>
)
}