Skip to content

Commit

Permalink
fix: 解决图片优化问题
Browse files Browse the repository at this point in the history
  • Loading branch information
huayemao committed May 26, 2024
1 parent ed19ae5 commit d45ef76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const SITE_META = {
name: "Dors.",
description: "花野猫的数字花园",
introduction: "花野猫生活、工作、学习的记录和分享",
url: "https://dors.huayemao.run",
author: {
url: "https://dors.huayemao.run",
name: "花野猫",
Expand Down
6 changes: 5 additions & 1 deletion lib/parseMDX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Raw from "@/components/Raw";
import Tag from "@/components/Tag";
import ToolBox from "@/components/ToolBox";
import Word from "@/components/Word";
import { SITE_META } from "@/constants";
import nextConfig from "@/next.config.mjs";
import Image from "next/image";
import remarkMath from "remark-math";
Expand Down Expand Up @@ -49,7 +50,10 @@ const components = {
<figure suppressHydrationWarning>
<a suppressHydrationWarning href={props.src}>
<Image
unoptimized={nextConfig.output === "export"}
unoptimized={
nextConfig.output === "export" ||
props.src.includes(SITE_META.url)
}
sizes="100vw"
style={{ width: "100%", height: "auto" }}
width={800}
Expand Down

0 comments on commit d45ef76

Please sign in to comment.