fix: disable static generation of marketing site pages
Disables the generation of the blog and content pages using generateStaticPaths to deal with a regression with routing introduced with next-runtime-env.
This commit is contained in:
@@ -5,11 +5,10 @@ import { allDocuments } from 'contentlayer/generated';
|
|||||||
import type { MDXComponents } from 'mdx/types';
|
import type { MDXComponents } from 'mdx/types';
|
||||||
import { useMDXComponent } from 'next-contentlayer/hooks';
|
import { useMDXComponent } from 'next-contentlayer/hooks';
|
||||||
|
|
||||||
export const generateStaticParams = () =>
|
export const dynamic = 'force-dynamic';
|
||||||
allDocuments.map((post) => ({ post: post._raw.flattenedPath }));
|
|
||||||
|
|
||||||
export const generateMetadata = ({ params }: { params: { content: string } }) => {
|
export const generateMetadata = ({ params }: { params: { content: string } }) => {
|
||||||
const document = allDocuments.find((post) => post._raw.flattenedPath === params.content);
|
const document = allDocuments.find((doc) => doc._raw.flattenedPath === params.content);
|
||||||
|
|
||||||
if (!document) {
|
if (!document) {
|
||||||
return { title: 'Not Found' };
|
return { title: 'Not Found' };
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ import { useMDXComponent } from 'next-contentlayer/hooks';
|
|||||||
|
|
||||||
export const dynamic = 'force-dynamic';
|
export const dynamic = 'force-dynamic';
|
||||||
|
|
||||||
export const generateStaticParams = () =>
|
|
||||||
allBlogPosts.map((post) => ({ post: post._raw.flattenedPath }));
|
|
||||||
|
|
||||||
export const generateMetadata = ({ params }: { params: { post: string } }) => {
|
export const generateMetadata = ({ params }: { params: { post: string } }) => {
|
||||||
const blogPost = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);
|
const blogPost = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { allBlogPosts } from 'contentlayer/generated';
|
|||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'Blog',
|
title: 'Blog',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BlogPage() {
|
export default function BlogPage() {
|
||||||
const blogPosts = allBlogPosts.sort((a, b) => {
|
const blogPosts = allBlogPosts.sort((a, b) => {
|
||||||
const dateA = new Date(a.date);
|
const dateA = new Date(a.date);
|
||||||
|
|||||||
Reference in New Issue
Block a user