diff --git a/README.md b/README.md index a558ebd5..2fb4d39d 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Ylarod
Ylarod

๐Ÿ”ง ๐Ÿ› + Etherrreal.
Etherrreal.

๐Ÿ”ง ๐Ÿ› + Joshua Astray
Joshua Astray

๐Ÿ”ง ๐Ÿ› diff --git a/package.json b/package.json index 8d68b740..3024d51a 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/pages/[...slug].js b/pages/[...slug].js index b4e1d47e..3013696d 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -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' diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js new file mode 100644 index 00000000..083edc0b --- /dev/null +++ b/pages/sitemap.xml.js @@ -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 () => { } diff --git a/styles/notion.css b/styles/notion.css index f3047f6b..9ec0e222 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -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{ diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js index e6900c09..af081a1c 100644 --- a/themes/hexo/components/ArticleRecommend.js +++ b/themes/hexo/components/ArticleRecommend.js @@ -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 (
-
+
{locale.COMMON.RELATE_POSTS}
diff --git a/themes/matery/components/MenuButtonGroupTop.js b/themes/matery/components/MenuButtonGroupTop.js index 89113279..e76eaa4a 100644 --- a/themes/matery/components/MenuButtonGroupTop.js +++ b/themes/matery/components/MenuButtonGroupTop.js @@ -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) { diff --git a/themes/matery/components/SideBar.js b/themes/matery/components/SideBar.js index 310cf681..f02d3245 100644 --- a/themes/matery/components/SideBar.js +++ b/themes/matery/components/SideBar.js @@ -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) {