diff --git a/themes/Empty/Layout404.js b/themes/Empty/Layout404.js new file mode 100644 index 00000000..cd28a607 --- /dev/null +++ b/themes/Empty/Layout404.js @@ -0,0 +1,6 @@ + +export const Layout404 = () => { + return
+ 404 Not found. +
+} diff --git a/themes/Empty/LayoutArchive.js b/themes/Empty/LayoutArchive.js new file mode 100644 index 00000000..e46502fc --- /dev/null +++ b/themes/Empty/LayoutArchive.js @@ -0,0 +1,5 @@ +export const LayoutArchive = ({ posts, tags, categories, postCount }) => { + return
+ Archive Page +
+} diff --git a/themes/Empty/LayoutBase.js b/themes/Empty/LayoutBase.js new file mode 100644 index 00000000..d302c580 --- /dev/null +++ b/themes/Empty/LayoutBase.js @@ -0,0 +1,40 @@ +import CommonHead from '@/components/CommonHead' + +/** + * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 + * @param children + * @param layout + * @param tags + * @param meta + * @param post + * @param currentSearch + * @param currentCategory + * @param currentTag + * @param categories + * @returns {JSX.Element} + * @constructor + */ +const LayoutBase = ({ + children, + headerSlot, + tags, + meta, + post, + postCount, + sideBarSlot, + floatSlot, + rightAreaSlot, + currentSearch, + currentCategory, + currentTag, + categories +}) => { + return (<> + +
+ {children} +
+ ) +} + +export default LayoutBase diff --git a/themes/Empty/LayoutCategory.js b/themes/Empty/LayoutCategory.js new file mode 100644 index 00000000..60e0d11a --- /dev/null +++ b/themes/Empty/LayoutCategory.js @@ -0,0 +1,5 @@ +export const LayoutCategory = ({ tags, posts, category, categories, latestPosts, postCount }) => { + return
+ Category - {category} +
+} diff --git a/themes/Empty/LayoutCategoryIndex.js b/themes/Empty/LayoutCategoryIndex.js new file mode 100644 index 00000000..467bde1c --- /dev/null +++ b/themes/Empty/LayoutCategoryIndex.js @@ -0,0 +1,11 @@ +export const LayoutCategoryIndex = ({ + tags, + allPosts, + categories, + postCount, + latestPosts +}) => { + return
+ CategoryIndex +
+} diff --git a/themes/Empty/LayoutIndex.js b/themes/Empty/LayoutIndex.js new file mode 100644 index 00000000..986951c3 --- /dev/null +++ b/themes/Empty/LayoutIndex.js @@ -0,0 +1,3 @@ +export const LayoutIndex = ({ posts, tags, meta, categories, postCount, latestPosts }) => { + return
Index
+} diff --git a/themes/Empty/LayoutPage.js b/themes/Empty/LayoutPage.js new file mode 100644 index 00000000..c025ff3c --- /dev/null +++ b/themes/Empty/LayoutPage.js @@ -0,0 +1,5 @@ +export const LayoutPage = ({ page, posts, tags, meta, categories, postCount, latestPosts }) => { + return
+ Page - {page} +
+} diff --git a/themes/Empty/LayoutSearch.js b/themes/Empty/LayoutSearch.js new file mode 100644 index 00000000..76e4867c --- /dev/null +++ b/themes/Empty/LayoutSearch.js @@ -0,0 +1,34 @@ +import { useRouter } from 'next/router' + +export const LayoutSearch = ({ + posts, + tags, + categories, + postCount +}) => { + let filteredPosts + const searchKey = getSearchKey() + if (searchKey) { + filteredPosts = posts.filter(post => { + const tagContent = post.tags ? post.tags.join(' ') : '' + const searchContent = post.title + post.summary + tagContent + return searchContent.toLowerCase().includes(searchKey.toLowerCase()) + }) + } else { + filteredPosts = posts + } + + console.log(filteredPosts) + + return
+ Search {searchKey} +
+} + +function getSearchKey () { + const router = useRouter() + if (router.query && router.query.s) { + return router.query.s + } + return null +} diff --git a/themes/Empty/LayoutSlug.js b/themes/Empty/LayoutSlug.js new file mode 100644 index 00000000..9335af67 --- /dev/null +++ b/themes/Empty/LayoutSlug.js @@ -0,0 +1,21 @@ +import 'prismjs' +import 'prismjs/components/prism-bash' +import 'prismjs/components/prism-javascript' +import 'prismjs/components/prism-markup' +import 'prismjs/components/prism-python' +import 'prismjs/components/prism-typescript' + +export const LayoutSlug = ({ + post, + tags, + prev, + next, + recommendPosts, + categories, + postCount, + latestPosts +}) => { + return
+ Slug +
+} diff --git a/themes/Empty/LayoutTag.js b/themes/Empty/LayoutTag.js new file mode 100644 index 00000000..cae36f38 --- /dev/null +++ b/themes/Empty/LayoutTag.js @@ -0,0 +1,5 @@ +export const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) => { + return
+ Tag - {tag} +
+} diff --git a/themes/Empty/LayoutTagIndex.js b/themes/Empty/LayoutTagIndex.js new file mode 100644 index 00000000..deb76f8e --- /dev/null +++ b/themes/Empty/LayoutTagIndex.js @@ -0,0 +1,5 @@ +export const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => { + return
+ TagIndex +
+} diff --git a/themes/Empty/config_empty.js b/themes/Empty/config_empty.js new file mode 100644 index 00000000..e69de29b diff --git a/themes/Empty/index.js b/themes/Empty/index.js new file mode 100644 index 00000000..aabed077 --- /dev/null +++ b/themes/Empty/index.js @@ -0,0 +1,10 @@ +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' diff --git a/themes/index.js b/themes/index.js index 7a6abb4b..9adbd8cd 100644 --- a/themes/index.js +++ b/themes/index.js @@ -1 +1,6 @@ +/** + * 直接将./NEXT 替换成对应的主题路径 + */ + export * from './NEXT' // 切换主题 +// export * from './Empty' // 切换主题