Skip to content

Commit

Permalink
Switch to node mode to fix MDX rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
noobnooc committed Mar 18, 2024
1 parent 5a134f5 commit 8d33635
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 327 deletions.
3 changes: 2 additions & 1 deletion app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import avatar from "../../public/avatar.png";
import Link from "next/link";
import { dictionaryKeys, getDictionary } from "../../dictionaries";

export const runtime = "edge";
// MDX rendering will crash in edge runtime because `eval` is disabled in edge runtime.
// export const runtime = "edge";

export async function generateMetadata({
params,
Expand Down
25 changes: 15 additions & 10 deletions app/[lang]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SiGithub } from "@icons-pack/react-simple-icons";
import { ReactNode } from "react";
import Card from "../../components/card";
import ProfileCard from "../../components/profile-card";
Expand All @@ -7,6 +6,8 @@ import { twMerge } from "tailwind-merge";
import subnooc from "../../public/subnooc.png";
import { shuffleArray } from "../../lib/array";
import { getDictionary } from "@/dictionaries";
import Link from "next/link";
import { PencilIcon } from "@heroicons/react/24/solid";

export const runtime = "edge";

Expand Down Expand Up @@ -128,6 +129,16 @@ export default async function Home({
{dictionary.labels.writing}
</Label>
<div className="grid grid-cols-2 gap-4 sm:gap-8">
<Card>
<Link
className="flex aspect-square flex-col"
href={dictionary.urls.posts}
>
<PencilIcon className="mb-auto box-border h-12 w-12 self-end rounded-lg border bg-black p-3 text-white sm:h-16 sm:w-16" />
<Subtitle>nooc.me/posts</Subtitle>
<Title className="">{dictionary.labels.posts}</Title>
</Link>
</Card>
<Card
className="flex aspect-square flex-col bg-red-300/10 dark:bg-red-400/10"
link="https://subnooc.com"
Expand All @@ -140,15 +151,9 @@ export default async function Home({
src={subnooc}
/>
<Subtitle>subnooc.com</Subtitle>
<Title className="text-red-500">主观世界</Title>
</Card>
<Card
className="flex aspect-square flex-col bg-neutral-300/10 dark:bg-neutral-400/10"
link="https://github.com/noobnooc/noobnooc/discussions"
>
<SiGithub className="mb-auto box-border h-12 w-12 self-end rounded-lg border bg-black p-2 text-white sm:h-16 sm:w-16" />
<Subtitle>github.com</Subtitle>
<Title className="">技术分享</Title>
<Title className="text-red-500">
{dictionary.labels.subnooc}
</Title>
</Card>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions app/[lang]/posts/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const runtime = "edge";

import { posts } from "@/.velite";
import { CalendarDaysIcon, LanguageIcon } from "@heroicons/react/24/solid";
import { displayDate } from "@/lib/date";
Expand Down
4 changes: 2 additions & 2 deletions app/[lang]/posts/categories/[categorySlug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const runtime = "edge";

import { posts, categories } from "@/.velite";
import { CalendarDaysIcon } from "@heroicons/react/24/solid";
import Link from "next/link";
Expand All @@ -8,6 +6,8 @@ import { Metadata } from "next";
import { notFound } from "next/navigation";
import { displayDate } from "@/lib/date";

export const runtime = "edge";

export async function generateMetadata({
params,
}: {
Expand Down
4 changes: 2 additions & 2 deletions app/[lang]/posts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const runtime = "edge";

import { posts, categories } from "@/.velite";
import { CalendarDaysIcon } from "@heroicons/react/24/solid";
import Link from "next/link";
import { displayDate } from "../../../lib/date";
import { Language, getDictionary } from "@/dictionaries";
import { Metadata } from "next";

export const runtime = "edge";

export async function generateMetadata({
params,
}: {
Expand Down
310 changes: 0 additions & 310 deletions content/posts/2024-03-15 set-up-blog-with-velite/en.mdx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dictionaries/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ A fan of Serverless.
toc: "Table of Contents",
categories: "Categories",
shareTo: "Share to: ",
subnooc: "Subjective Nooc",
icon(label: string) {
return `Icon for ${label}`;
},
Expand Down
1 change: 1 addition & 0 deletions dictionaries/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Serverless 爱好者。
toc: "目录",
categories: "分类",
shareTo: "分享到:",
subnooc: "主观世界",
icon(label: string) {
return `${label}的图标`;
},
Expand Down

0 comments on commit 8d33635

Please sign in to comment.