game 主题支持PWA

This commit is contained in:
tangly1024.com
2024-04-01 13:19:39 +08:00
parent 56cf3cfce1
commit de2fe3baf3
8 changed files with 143 additions and 39 deletions

View File

@@ -13,7 +13,10 @@ import { useRouter } from 'next/router'
*/
const Index = props => {
// 根据页面路径加载不同Layout文件
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
const Layout = getLayoutByTheme({
theme: siteConfig('THEME'),
router: useRouter()
})
return <Layout {...props} />
}
@@ -25,7 +28,9 @@ export async function getStaticProps() {
const from = 'index'
const props = await getGlobalData({ from })
props.posts = props.allPages?.filter(page => page.type === 'Post' && page.status === 'Published')
props.posts = props.allPages?.filter(
page => page.type === 'Post' && page.status === 'Published'
)
// 处理分页
if (siteConfig('POST_LIST_STYLE') === 'scroll') {
@@ -41,7 +46,11 @@ export async function getStaticProps() {
if (post.password && post.password !== '') {
continue
}
post.blockMap = await getPostBlocks(post.id, 'slug', siteConfig('POST_PREVIEW_LINES'))
post.blockMap = await getPostBlocks(
post.id,
'slug',
siteConfig('POST_PREVIEW_LINES')
)
}
}