Merge pull request #662 from tangly1024/3.7.2

3.7.2修复问题
This commit is contained in:
tangly1024
2023-01-01 18:57:48 +08:00
committed by GitHub
8 changed files with 76 additions and 9 deletions

View File

@@ -65,6 +65,8 @@
<td align="center"><a href="https://github.com/Ylarod"><img src="https://avatars.githubusercontent.com/u/30978685" width="64px;" alt="Ylarod"/><br/><sub><b>Ylarod</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=Ylarod" title="Ylarod" >🔧 🐛</a></td>
<td align="center"><a href="https://github.com/lifeafter619"><img src="https://avatars.githubusercontent.com/u/65111206" width="64px;" alt="Etherrreal."/><br/><sub><b>Etherrreal.</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=lifeafter619" title="Etherrreal." >🔧 🐛</a></td>
<td align="center"><a href="https://github.com/ykxkykx"><img src="https://avatars.githubusercontent.com/u/17985993" width="64px;" alt="Joshua Astray"/><br/><sub><b>Joshua Astray</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=ykxkykx" title="ykxkykx" >🔧 🐛</a></td>
</tr>

View File

@@ -14,7 +14,7 @@
},
"scripts": {
"dev": "next dev",
"build": "next build && next-sitemap --config next-sitemap.config.js",
"build": "next build",
"start": "next start",
"post-build": "next-sitemap --config next-sitemap.config.js",
"bundle-report": "ANALYZE=true yarn build"

View File

@@ -108,7 +108,6 @@ export async function getStaticPaths() {
export async function getStaticProps({ params: { slug } }) {
let fullSlug = slug.join('/')
console.log('[读取Notion]', fullSlug)
if (BLOG.PSEUDO_STATIC) {
if (!fullSlug.endsWith('.html')) {
fullSlug += '.html'

60
pages/sitemap.xml.js Normal file
View File

@@ -0,0 +1,60 @@
// pages/sitemap.xml.js
import { getServerSideSitemap } from 'next-sitemap'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import BLOG from '@/blog.config'
export const getServerSideProps = async (ctx) => {
const { allPages } = await getGlobalNotionData({ from: 'rss' })
const defaultFields = [
{
loc: `${BLOG.LINK}`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}, {
loc: `${BLOG.LINK}/archive`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}, {
loc: `${BLOG.LINK}/category`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}, {
loc: `${BLOG.LINK}/feed`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}, {
loc: `${BLOG.LINK}/search`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}, {
loc: `${BLOG.LINK}/tag`,
lastmod: new Date(),
changefreq: 'daily',
priority: '0.7'
}
]
const postFields = allPages?.map(post => {
return {
loc: `${BLOG.LINK}/${post.slug}`,
lastmod: new Date(post?.date?.start_date || post?.createdTime),
changefreq: 'daily',
priority: '0.7'
}
})
const fields = defaultFields.concat(postFields)
// 缓存
// ctx.res.setHeader(
// 'Cache-Control',
// 'public, s-maxage=10, stale-while-revalidate=59'
// )
return getServerSideSitemap(ctx, fields)
}
export default () => { }

View File

@@ -1965,7 +1965,7 @@ thead, tbody tr {
}
.notion-collection-card{
@apply dark:hover:text-gray-200
@apply dark:text-gray-200 dark:bg-gray-800 dark:hover:bg-black
}
.notion-code-copy{

View File

@@ -9,6 +9,8 @@ import { useGlobal } from '@/lib/global'
* @returns
*/
export default function ArticleRecommend({ recommendPosts, siteInfo }) {
const { locale } = useGlobal()
if (
!CONFIG_HEXO.ARTICLE_RECOMMEND ||
!recommendPosts ||
@@ -16,11 +18,11 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
) {
return <></>
}
const { locale } = useGlobal()
return (
<div className="p-2">
<div className=" mb-2 px-1 flex flex-nowrap justify-between">
<div>
<div className='dark:text-gray-300'>
<i className="mr-2 fas fa-thumbs-up" />
{locale.COMMON.RELATE_POSTS}
</div>

View File

@@ -9,9 +9,9 @@ const MenuButtonGroupTop = (props) => {
let links = [
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_MATERY.MENU_ARCHIVE },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_MATERY.MENU_SEARCH }
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_MATERY.MENU_CATEGORY },
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_MATERY.MENU_TAG }
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_MATERY.MENU_SEARCH },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_MATERY.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_MATERY.MENU_TAG }
]
if (customNav) {

View File

@@ -2,6 +2,7 @@ import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import { useRouter } from 'next/router'
import CONFIG_MATERY from '../config_matery'
/**
* 标签组
@@ -18,7 +19,10 @@ const SideBar = (props) => {
const defaultLinks = [
{ icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: true },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: true }
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_MATERY.MENU_ARCHIVE },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_MATERY.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_MATERY.MENU_TAG }
]
let links = [].concat(defaultLinks)
if (customNav) {