diff --git a/blog.config.js b/blog.config.js index 83fb4061..8cc40d7a 100644 --- a/blog.config.js +++ b/blog.config.js @@ -8,11 +8,13 @@ const BLOG = { KEYWORDS: 'Notion, 博客', // 网站关键词 英文逗号隔开 NOTION_PAGE_ID: process.env.NOTION_PAGE_ID || '02ab3b8678004aa69e9e415905ef32a5', // Important page_id!!!Duplicate Template from https://www.notion.so/tanghh/02ab3b8678004aa69e9e415905ef32a5 NOTION_ACCESS_TOKEN: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public + DEBUG_BUTTON: true, // 是否显示调试按钮,可以用来调试不同的主题和样式配置 + THEME: process.env.NEXT_PUBLIC_THEME || 'next', // 主题, 支持 ['Next','Hexo',"Fukasawa','Medium'] LANG: 'zh-CN', // e.g 'zh-CN','en-US' see /lib/lang.js for more. SINCE: 2021, // e.g if leave this empty, current year will be used. BEI_AN: process.env.NEXT_PUBLIC_BEI_AN || '', // 备案号 闽ICP备XXXXXXX - APPEARANCE: 'auto', // ['light', 'dark', 'auto'], + APPEARANCE: 'light', // ['light', 'dark', 'auto'], // light 日间模式 , dark夜间模式, auto根据时间和主题自动夜间模式 FONT: 'font-serif tracking-wider subpixel-antialiased', // 文章字体 ['font-sans', 'font-serif', 'font-mono'] @see https://www.tailwindcss.cn/docs/font-family FONT_AWESOME_PATH: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.4/css/all.min.css', // 图标库CDN ,国内推荐BootCDN,国外推荐 CloudFlare https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css BACKGROUND_LIGHT: '#eeeeee', // use hex value, don't forget '#' e.g #fffefc @@ -20,7 +22,7 @@ const BLOG = { PATH: '', // leave this empty unless you want to deploy in a folder POST_LIST_STYLE: 'page', // ['page','scroll] 文章列表样式:页码分页、单页滚动加载 - POST_LIST_PREVIEW: false, // 是否在列表加载文章预览, 会被各主题中的同名配置覆盖,例:/themes/NEXT/config_next.js + POST_LIST_PREVIEW: false, // 是否在列表加载文章预览 POST_PREVIEW_LINES: 12, // 预览博客行数 POSTS_PER_PAGE: 6, // post counts per page POSTS_SORT_BY: 'notion', // 排序方式 'date'按时间,'notion'由notion控制 diff --git a/components/DebugButton.js b/components/DebugButton.js new file mode 100644 index 00000000..a20c97b2 --- /dev/null +++ b/components/DebugButton.js @@ -0,0 +1,50 @@ +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' +import { useState } from 'react' + +/** + * + * @returns 调试面板 + */ +export function DebugButton () { + const [show, setShow] = useState(false) + const GlobalConfig = useGlobal() + const { theme, setTheme } = GlobalConfig + const allThemes = Object.keys(ThemeMap) + function toggleShow () { + setShow(!show) + } + + /** + * 切换主题 + */ + function changeTheme () { + const currentIndex = allThemes.indexOf(theme) + const newIndex = currentIndex < allThemes.length - 1 ? currentIndex + 1 : 0 + setTheme(allThemes[newIndex]) + } + + return <> +
+
+
当前主题:
+
{theme}
+
+
+
所有主题:
+
{allThemes.join(',')}
+
+
+
更换主题
+
+
+
所有配置:
+

{JSON.stringify(GlobalConfig)}

+
+
+ +
+
调试按钮
+
+ +} diff --git a/jsconfig.json b/jsconfig.json index 9802ad57..f6f71d10 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -5,7 +5,6 @@ "@/*": ["./*"], "@/components/*": ["components/*"], "@/data/*": ["data/*"], - "@/layouts/*": ["theme/*"], "@/lib/*": ["lib/*"], "@/styles/*": ["styles/*"] } diff --git a/lib/global.js b/lib/global.js index 08628942..28b5b292 100644 --- a/lib/global.js +++ b/lib/global.js @@ -2,6 +2,7 @@ import lang from './lang' import { useContext, createContext, useState } from 'react' import Router from 'next/router' import { initDarkMode } from './theme' +import BLOG from '@/blog.config' const GlobalContext = createContext() let hasInit = false @@ -15,6 +16,8 @@ export function GlobalContextProvider ({ children }) { const [locale, updateLocale] = useState(generateLocaleDict('en-US')) const [isDarkMode, updateDarkMode] = useState(false) const [onLoading, changeLoadingState] = useState(false) + const [theme, setTheme] = useState(BLOG.THEME) + Router.events.on('routeChangeStart', (...args) => { changeLoadingState(true) }) @@ -33,7 +36,7 @@ export function GlobalContextProvider ({ children }) { }, 100) return ( - + {children} ) diff --git a/pages/404.js b/pages/404.js index 64cc2dc7..29423e5f 100644 --- a/pages/404.js +++ b/pages/404.js @@ -1,4 +1,5 @@ -import { Layout404 } from '@/themes' +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' /** * 自定义404界面 @@ -7,5 +8,7 @@ import { Layout404 } from '@/themes' */ export default function Custom404 (props) { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } diff --git a/pages/[slug].js b/pages/[slug].js index 8307c38f..5b1a6412 100644 --- a/pages/[slug].js +++ b/pages/[slug].js @@ -1,8 +1,9 @@ import BLOG from '@/blog.config' import { getPostBlocks } from '@/lib/notion' import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutSlug } from '@/themes' -import Custom404 from '@/pages/404' +import { useGlobal } from '@/lib/global' +import Custom404 from './404' +import * as ThemeMap from '@/themes' /** * 根据notion的slug访问页面,针对类型为Page的页面 @@ -10,10 +11,12 @@ import Custom404 from '@/pages/404' * @returns */ const Slug = (props) => { + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] if (!props.post) { return } - return + return } export async function getStaticPaths () { diff --git a/pages/_app.js b/pages/_app.js index e5b63150..0f0948ed 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -14,6 +14,7 @@ import 'prismjs/themes/prism-okaidia.css' import 'katex/dist/katex.min.css' import dynamic from 'next/dynamic' import { GlobalContextProvider } from '@/lib/global' +import { DebugButton } from '@/components/DebugButton' const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false }) const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false }) @@ -23,6 +24,7 @@ const GoogleAdsense = dynamic(() => import('@/components/GoogleAdsense'), { ssr: const MyApp = ({ Component, pageProps }) => { return ( + {BLOG.DEBUG_BUTTON && } {BLOG.ANALYTICS_ACKEE_TRACKER && } {BLOG.ANALYTICS_GOOGLE_ID && } {JSON.parse(BLOG.ANALYTICS_BUSUANZI_ENABLE) && } diff --git a/pages/archive/index.js b/pages/archive/index.js index 4dffb49d..75bf91b1 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -1,6 +1,13 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' -import { LayoutArchive } from '@/themes' +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' + +const ArchiveIndex = (props) => { + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return +} export async function getStaticProps () { const { allPosts, categories, tags, postCount, customNav } = @@ -18,8 +25,4 @@ export async function getStaticProps () { } } -const ArchiveIndex = (props) => { - return -} - export default ArchiveIndex diff --git a/pages/article/[slug].js b/pages/article/[slug].js index d79e0cc7..bfe391d1 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -1,8 +1,9 @@ import BLOG from '@/blog.config' import { getPostBlocks } from '@/lib/notion' import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutSlug } from '@/themes' -import Custom404 from '@/pages/404' +import { useGlobal } from '@/lib/global' +import Custom404 from '../404' +import * as ThemeMap from '@/themes' /** * 根据notion的slug访问页面 @@ -10,10 +11,12 @@ import Custom404 from '@/pages/404' * @returns */ const Slug = (props) => { + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] if (!props.post) { return } - return + return } export async function getStaticPaths () { diff --git a/pages/category/[category].js b/pages/category/[category].js index 681a23c6..9e9f5f3f 100644 --- a/pages/category/[category].js +++ b/pages/category/[category].js @@ -1,9 +1,12 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' -import { LayoutCategory } from '@/themes' +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' export default function Category (props) { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } export async function getStaticProps ({ params }) { diff --git a/pages/category/index.js b/pages/category/index.js index 7361a706..dd195d4c 100644 --- a/pages/category/index.js +++ b/pages/category/index.js @@ -1,9 +1,12 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' -import { LayoutCategoryIndex } from '@/themes' +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' export default function Category (props) { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } export async function getStaticProps () { diff --git a/pages/index.js b/pages/index.js index 599b3cf9..02a15885 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,10 +1,12 @@ import BLOG from '@/blog.config' import { getPostBlocks } from '@/lib/notion' import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutIndex, THEME_CONFIG } from '@/themes' - +import * as ThemeMap from '@/themes' +import { useGlobal } from '@/lib/global' const Index = (props) => { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } export async function getStaticProps () { @@ -26,7 +28,7 @@ export async function getStaticProps () { BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page ) - if (THEME_CONFIG.POST_LIST_PREVIEW || BLOG.POST_LIST_PREVIEW) { + if (BLOG.POST_LIST_PREVIEW) { for (const i in postsToShow) { const post = postsToShow[i] const blockMap = await getPostBlocks(post.id, 'slug', BLOG.POST_PREVIEW_LINES) diff --git a/pages/page/[page].js b/pages/page/[page].js index 211a2f92..0d6c1759 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -1,14 +1,17 @@ import BLOG from '@/blog.config' import { getPostBlocks } from '@/lib/notion' import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutPage, THEME_CONFIG } from '@/themes' -import Custom404 from '@/pages/404' +import { useGlobal } from '@/lib/global' +import Custom404 from '../404' +import * as ThemeMap from '@/themes' const Page = (props) => { + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] if (!props?.meta) { return } - return + return } export async function getStaticPaths () { @@ -43,8 +46,7 @@ export async function getStaticProps ({ params: { page } }) { BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page ) - // 加载预览 - if (THEME_CONFIG.POST_LIST_PREVIEW || BLOG.POST_LIST_PREVIEW) { + if (BLOG.POST_LIST_PREVIEW) { for (const i in postsToShow) { const post = postsToShow[i] const blockMap = await getPostBlocks(post.id, 'slug', BLOG.POST_PREVIEW_LINES) diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index 4bc6166e..c00b6764 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -1,8 +1,22 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutSearch } from '@/themes' import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' import { getDataFromCache } from '@/lib/cache/cache_manager' +import * as ThemeMap from '@/themes' + +const Index = (props) => { + const { keyword } = props + const { locale } = useGlobal() + const meta = { + title: `${keyword || ''} | ${locale.NAV.SEARCH} | ${BLOG.TITLE} `, + description: BLOG.DESCRIPTION, + type: 'website' + } + + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return +} /** * 服务端搜索 @@ -33,17 +47,6 @@ export async function getServerSideProps ({ params: { keyword } }) { } } -const Index = (props) => { - const { keyword } = props - const { locale } = useGlobal() - const meta = { - title: `${keyword || ''} | ${locale.NAV.SEARCH} | ${BLOG.TITLE} `, - description: BLOG.DESCRIPTION, - type: 'website' - } - return -} - /** * 将对象的指定字段拼接到字符串 * @param sourceTextArray diff --git a/pages/search/index.js b/pages/search/index.js index fb1ffc89..bf0849d4 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -1,33 +1,8 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutSearch } from '@/themes' import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' import { useRouter } from 'next/router' - -/** - * 浏览器前端搜索 - */ -export async function getStaticProps () { - const { - allPosts, - categories, - tags, - postCount, - latestPosts, - customNav - } = await getGlobalNotionData({ from: 'search-props', pageType: ['Post'] }) - return { - props: { - posts: allPosts, - tags, - categories, - postCount, - latestPosts, - customNav - }, - revalidate: 1 - } -} +import * as ThemeMap from '@/themes' const Search = (props) => { const { posts } = props @@ -51,7 +26,29 @@ const Search = (props) => { description: BLOG.DESCRIPTION, type: 'website' } - return + + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + + return +} + +/** + * 浏览器前端搜索 + */ +export async function getStaticProps () { + const { allPosts, categories, tags, postCount, latestPosts, customNav } = await getGlobalNotionData({ from: 'search-props', pageType: ['Post'] }) + return { + props: { + posts: allPosts, + tags, + categories, + postCount, + latestPosts, + customNav + }, + revalidate: 1 + } } function getSearchKey () { diff --git a/pages/tag/[tag].js b/pages/tag/[tag].js index 169352f6..238248bd 100644 --- a/pages/tag/[tag].js +++ b/pages/tag/[tag].js @@ -1,8 +1,11 @@ +import { useGlobal } from '@/lib/global' import { getGlobalNotionData } from '@/lib/notion/getNotionData' -import { LayoutTag } from '@/themes' +import * as ThemeMap from '@/themes' const Tag = (props) => { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } export async function getStaticProps ({ params }) { diff --git a/pages/tag/index.js b/pages/tag/index.js index cdf8a401..d8a7911a 100644 --- a/pages/tag/index.js +++ b/pages/tag/index.js @@ -1,9 +1,12 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' -import { LayoutTagIndex } from '@/themes' +import { useGlobal } from '@/lib/global' +import * as ThemeMap from '@/themes' const TagIndex = (props) => { - return + const { theme } = useGlobal() + const ThemeComponents = ThemeMap[theme] + return } export async function getStaticProps () { diff --git a/styles/notion.css b/styles/notion.css index b8466a2a..d42d3b11 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -992,7 +992,7 @@ svg.notion-page-icon { .notion-board-header { display: flex; position: absolute; - z-index: 82; + z-index: 30; height: 44px; min-width: 100%; } @@ -1749,7 +1749,7 @@ pre[class*='language-'] { .notion-table-header { display: flex; position: absolute; - z-index: 82; + z-index:30; height: 33px; color: var(--fg-color-3); min-width: var(--notion-max-width); diff --git a/themes/Empty/LayoutPage.js b/themes/Empty/LayoutPage.js index f25ee48f..661a104b 100644 --- a/themes/Empty/LayoutPage.js +++ b/themes/Empty/LayoutPage.js @@ -1,4 +1,4 @@ -import LayoutBase from '../Empty/LayoutBase' +import LayoutBase from './LayoutBase' export const LayoutPage = (props) => { const { page } = props diff --git a/themes/Empty/index.js b/themes/Empty/index.js index 22fd5d15..95b0a6b2 100644 --- a/themes/Empty/index.js +++ b/themes/Empty/index.js @@ -1,12 +1,25 @@ import CONFIG_EMPTY from './config_empty' -export { CONFIG_EMPTY as THEME_CONFIG } -export { LayoutIndex } from './LayoutIndex' -export { LayoutSearch } from './LayoutSearch' -export { LayoutArchive } from './LayoutArchive' -export { LayoutSlug } from './LayoutSlug' -export { Layout404 } from './Layout404' -export { LayoutCategory } from './LayoutCategory' -export { LayoutCategoryIndex } from './LayoutCategoryIndex' -export { LayoutPage } from './LayoutPage' -export { LayoutTag } from './LayoutTag' -export { LayoutTagIndex } from './LayoutTagIndex' +import { LayoutIndex } from './LayoutIndex' +import { LayoutSearch } from './LayoutSearch' +import { LayoutArchive } from './LayoutArchive' +import { LayoutSlug } from './LayoutSlug' +import { Layout404 } from './Layout404' +import { LayoutCategory } from './LayoutCategory' +import { LayoutCategoryIndex } from './LayoutCategoryIndex' +import { LayoutPage } from './LayoutPage' +import { LayoutTag } from './LayoutTag' +import { LayoutTagIndex } from './LayoutTagIndex' + +export { + CONFIG_EMPTY as THEME_CONFIG, + LayoutIndex, + LayoutSearch, + LayoutArchive, + LayoutSlug, + Layout404, + LayoutCategory, + LayoutCategoryIndex, + LayoutPage, + LayoutTag, + LayoutTagIndex +} diff --git a/themes/Fukasawa/index.js b/themes/Fukasawa/index.js index e9e4db72..58968469 100644 --- a/themes/Fukasawa/index.js +++ b/themes/Fukasawa/index.js @@ -1,12 +1,25 @@ import CONFIG_FUKA from './config_fuka' -export { CONFIG_FUKA as THEME_CONFIG } -export { LayoutIndex } from './LayoutIndex' -export { LayoutSearch } from './LayoutSearch' -export { LayoutArchive } from './LayoutArchive' -export { LayoutSlug } from './LayoutSlug' -export { Layout404 } from './Layout404' -export { LayoutCategory } from './LayoutCategory' -export { LayoutCategoryIndex } from './LayoutCategoryIndex' -export { LayoutPage } from './LayoutPage' -export { LayoutTag } from './LayoutTag' -export { LayoutTagIndex } from './LayoutTagIndex' +import { LayoutIndex } from './LayoutIndex' +import { LayoutSearch } from './LayoutSearch' +import { LayoutArchive } from './LayoutArchive' +import { LayoutSlug } from './LayoutSlug' +import { Layout404 } from './Layout404' +import { LayoutCategory } from './LayoutCategory' +import { LayoutCategoryIndex } from './LayoutCategoryIndex' +import { LayoutPage } from './LayoutPage' +import { LayoutTag } from './LayoutTag' +import { LayoutTagIndex } from './LayoutTagIndex' + +export { + CONFIG_FUKA as THEME_CONFIG, + LayoutIndex, + LayoutSearch, + LayoutArchive, + LayoutSlug, + Layout404, + LayoutCategory, + LayoutCategoryIndex, + LayoutPage, + LayoutTag, + LayoutTagIndex +} diff --git a/themes/Hexo/components/TopNav.js b/themes/Hexo/components/TopNav.js index 464277c5..6ed6d7c9 100644 --- a/themes/Hexo/components/TopNav.js +++ b/themes/Hexo/components/TopNav.js @@ -112,7 +112,6 @@ const TopNav = (props) => { - ) } diff --git a/themes/Hexo/index.js b/themes/Hexo/index.js index 15af8476..8528d5da 100644 --- a/themes/Hexo/index.js +++ b/themes/Hexo/index.js @@ -1,12 +1,25 @@ import CONFIG_HEXO from './config_hexo' -export { LayoutIndex } from './LayoutIndex' -export { LayoutSearch } from './LayoutSearch' -export { LayoutArchive } from './LayoutArchive' -export { LayoutSlug } from './LayoutSlug' -export { Layout404 } from './Layout404' -export { LayoutCategory } from './LayoutCategory' -export { LayoutCategoryIndex } from './LayoutCategoryIndex' -export { LayoutPage } from './LayoutPage' -export { LayoutTag } from './LayoutTag' -export { LayoutTagIndex } from './LayoutTagIndex' -export { CONFIG_HEXO as THEME_CONFIG } +import { LayoutIndex } from './LayoutIndex' +import { LayoutSearch } from './LayoutSearch' +import { LayoutArchive } from './LayoutArchive' +import { LayoutSlug } from './LayoutSlug' +import { Layout404 } from './Layout404' +import { LayoutCategory } from './LayoutCategory' +import { LayoutCategoryIndex } from './LayoutCategoryIndex' +import { LayoutPage } from './LayoutPage' +import { LayoutTag } from './LayoutTag' +import { LayoutTagIndex } from './LayoutTagIndex' + +export { + CONFIG_HEXO as THEME_CONFIG, + LayoutIndex, + LayoutSearch, + LayoutArchive, + LayoutSlug, + Layout404, + LayoutCategory, + LayoutCategoryIndex, + LayoutPage, + LayoutTag, + LayoutTagIndex +} diff --git a/themes/Medium/components/BottomMenuBar.js b/themes/Medium/components/BottomMenuBar.js index e56b2601..8678afa7 100644 --- a/themes/Medium/components/BottomMenuBar.js +++ b/themes/Medium/components/BottomMenuBar.js @@ -1,6 +1,6 @@ import Link from 'next/link' import React from 'react' -import JumpToTopButton from '@/themes/Medium/components/JumpToTopButton' +import JumpToTopButton from './JumpToTopButton' export default function BottomMenuBar ({ className }) { return ( diff --git a/themes/Medium/components/TopNavBar.js b/themes/Medium/components/TopNavBar.js index fcbb84fc..78daa747 100644 --- a/themes/Medium/components/TopNavBar.js +++ b/themes/Medium/components/TopNavBar.js @@ -1,6 +1,6 @@ -import LogoBar from '@/themes/Medium/components/LogoBar' import Link from 'next/link' import { useRouter } from 'next/router' +import LogoBar from './LogoBar' /** * 顶部导航栏 + 菜单 diff --git a/themes/Medium/index.js b/themes/Medium/index.js index 5bcc655c..81961c58 100644 --- a/themes/Medium/index.js +++ b/themes/Medium/index.js @@ -1,12 +1,25 @@ import CONFIG_MEDIUM from './config_medium' -export { CONFIG_MEDIUM as THEME_CONFIG } -export { LayoutIndex } from './LayoutIndex' -export { LayoutSearch } from './LayoutSearch' -export { LayoutArchive } from './LayoutArchive' -export { LayoutSlug } from './LayoutSlug' -export { Layout404 } from './Layout404' -export { LayoutCategory } from './LayoutCategory' -export { LayoutCategoryIndex } from './LayoutCategoryIndex' -export { LayoutPage } from './LayoutPage' -export { LayoutTag } from './LayoutTag' -export { LayoutTagIndex } from './LayoutTagIndex' +import { LayoutIndex } from './LayoutIndex' +import { LayoutSearch } from './LayoutSearch' +import { LayoutArchive } from './LayoutArchive' +import { LayoutSlug } from './LayoutSlug' +import { Layout404 } from './Layout404' +import { LayoutCategory } from './LayoutCategory' +import { LayoutCategoryIndex } from './LayoutCategoryIndex' +import { LayoutPage } from './LayoutPage' +import { LayoutTag } from './LayoutTag' +import { LayoutTagIndex } from './LayoutTagIndex' + +export { + CONFIG_MEDIUM as THEME_CONFIG, + LayoutIndex, + LayoutSearch, + LayoutArchive, + LayoutSlug, + Layout404, + LayoutCategory, + LayoutCategoryIndex, + LayoutPage, + LayoutTag, + LayoutTagIndex +} diff --git a/themes/NEXT/index.js b/themes/NEXT/index.js index 76179137..45286719 100644 --- a/themes/NEXT/index.js +++ b/themes/NEXT/index.js @@ -1,12 +1,25 @@ import CONFIG_NEXT from './config_next' -export { CONFIG_NEXT as THEME_CONFIG } -export { LayoutIndex } from './LayoutIndex' -export { LayoutSearch } from './LayoutSearch' -export { LayoutArchive } from './LayoutArchive' -export { LayoutSlug } from './LayoutSlug' -export { Layout404 } from './Layout404' -export { LayoutCategory } from './LayoutCategory' -export { LayoutCategoryIndex } from './LayoutCategoryIndex' -export { LayoutPage } from './LayoutPage' -export { LayoutTag } from './LayoutTag' -export { LayoutTagIndex } from './LayoutTagIndex' +import { LayoutIndex } from './LayoutIndex' +import { LayoutSearch } from './LayoutSearch' +import { LayoutArchive } from './LayoutArchive' +import { LayoutSlug } from './LayoutSlug' +import { Layout404 } from './Layout404' +import { LayoutCategory } from './LayoutCategory' +import { LayoutCategoryIndex } from './LayoutCategoryIndex' +import { LayoutPage } from './LayoutPage' +import { LayoutTag } from './LayoutTag' +import { LayoutTagIndex } from './LayoutTagIndex' + +export { + CONFIG_NEXT as THEME_CONFIG, + LayoutIndex, + LayoutSearch, + LayoutArchive, + LayoutSlug, + Layout404, + LayoutCategory, + LayoutCategoryIndex, + LayoutPage, + LayoutTag, + LayoutTagIndex +} diff --git a/themes/index.js b/themes/index.js index 5acc65dd..d47d2a42 100644 --- a/themes/index.js +++ b/themes/index.js @@ -2,8 +2,15 @@ * 修改 from 后面的路径,实现主题切换 */ -// export * from './Empty' // 空主题 -// export * from './NEXT' -// export * from './Fukasawa' -export * from './Hexo' -// export * from './Medium' +import * as next from './next' +import * as fukasawa from './fukasawa' +import * as hexo from './hexo' +import * as medium from './medium' +import * as empty from './empty' +export { + next, + fukasawa, + hexo, + medium, + empty +}