fix(site): resolve 404 route bugs, localize 404 pages, fix hreflang alternates, add language links for crawlers, enable blog dark mode, optimize testimonial avatar sizing, and update burger icon stroke
Deploy Frontend / deploy (push) Successful in 1m7s

This commit is contained in:
Parsa Aghayi committed 2026-11-02 08:26:31 +00:00
1 parent 3a105cdc6a
commit efe9a29adb
11 files changed
+87 -52

No files matched your search

+3 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 18L20 18" stroke="#000000" stroke-width="2" stroke-linecap="round"/>
<path d="M4 12L20 12" stroke="#000000" stroke-width="2" stroke-linecap="round"/>
<path d="M4 6L20 6" stroke="#000000" stroke-width="2" stroke-linecap="round"/>
<path d="M4 18L20 18" stroke="#ffffff" stroke-width="2" stroke-linecap="round"/>
<path d="M4 12L20 12" stroke="#ffffff" stroke-width="2" stroke-linecap="round"/>
<path d="M4 6L20 6" stroke="#ffffff" stroke-width="2" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 468 B

@@ -1,7 +1,7 @@
import Image from "next/image";
import Link from "next/link";
import { pickStableIndex } from "@/app/lib/functions/client-utils";
import { getDefaultLocale } from "@/app/lib/functions/utils";
const NOT_FOUND_ILLUSTRATIONS = 5;
@@ -13,25 +13,37 @@ interface PropsType {
export default async function NotFound(props: PropsType) {
const params = await props.params;
const requestedPath = params.notFound.join("/");
const requestedPath = "/" + params.notFound.join("/");
const imageUrl = `/images/404/${pickStableIndex(requestedPath, NOT_FOUND_ILLUSTRATIONS) + 1}.jpg`;
const locale = await getDefaultLocale();
const isFa = locale === "fa";
return (
<div className="mt-[80px] flex flex-col items-center justify-center gap-3">
<Image src={imageUrl} width={500} height={500} alt="404 illustration" />
<h2 className="text-[30px] font-[800]">Nothing Found!</h2>
<p className="select-none font-[600]">
Could not find{" "}
<span className="cursor-pointer font-[800] text-[#fd6f00] underline">
/blog/{requestedPath}
</span>{" "}
!
<div className="my-24 flex flex-col items-center justify-center gap-4 px-6 text-center">
<div className="relative overflow-hidden rounded-2xl border border-border shadow-xl">
<Image
src={imageUrl}
width={450}
height={450}
alt="404 illustration"
className="h-auto max-w-[320px] sm:max-w-[450px] object-cover"
/>
</div>
<h2 className="text-3xl font-extrabold text-foreground sm:text-4xl">
{isFa ? "صفحه مورد نظر یافت نشد!" : "Nothing Found!"}
</h2>
<p className="select-none font-medium text-muted-foreground text-sm sm:text-base">
{isFa ? "مسیر " : "Could not find "}
<span className="font-bold text-primary underline inline-block" dir="ltr">
{requestedPath}
</span>
{isFa ? " در دسترس نیست یا جابه‌جا شده است." : " !"}
</p>
<Link
href="/"
className="rounded-md border border-[#fd6f00] px-5 py-3 font-[500] text-[#fd6f00]"
className="mt-4 rounded-full bg-primary px-6 py-2.5 text-sm font-semibold text-primary-foreground shadow-lg shadow-primary/30 transition-all duration-300 hover:scale-105 active:scale-95"
>
Return Home
{isFa ? "بازگشت به صفحه اصلی" : "Return Home"}
</Link>
</div>
);
@@ -48,7 +48,7 @@ export default function SelectLanguage() {
}`}
>
<Link
href=""
href="?lang=fa"
className={`${optionClassName} font-[var(--font-mikhak)]`}
onClick={(e) => {
e.preventDefault();
@@ -58,7 +58,7 @@ export default function SelectLanguage() {
فارسی
</Link>
<Link
href=""
href="?lang=en"
className={`${optionClassName} font-sans`}
onClick={(e) => {
e.preventDefault();
@@ -108,6 +108,7 @@ export default function Testimonials({ dict }: TestimonialsProps) {
src={getCleanImgSrc(testimonial.image)}
alt={testimonial.name}
fill
sizes="48px"
className="object-cover"
/>
</div>
+4 -4
View File
@@ -48,11 +48,11 @@ export const metadata: Metadata = {
creator: SITE_NAME,
publisher: SITE_NAME,
alternates: {
canonical: "./",
canonical: "/",
languages: {
fa: "./",
en: "./",
"x-default": "./",
fa: "/?lang=fa",
en: "/?lang=en",
"x-default": "/",
},
},
openGraph: {
+23 -17
View File
@@ -1,7 +1,7 @@
import Image from "next/image";
import Link from "next/link";
import { pickStableIndex } from "@/app/lib/functions/client-utils";
import { getDefaultLocale } from "@/app/lib/functions/utils";
const NOT_FOUND_ILLUSTRATIONS = 5;
@@ -15,29 +15,35 @@ export default async function NotFound(props: PropsType) {
const params = await props.params;
const requestedPath = params.notFound.join("/");
const imageUrl = `/images/404/${pickStableIndex(requestedPath, NOT_FOUND_ILLUSTRATIONS) + 1}.jpg`;
const locale = await getDefaultLocale();
const isFa = locale === "fa";
return (
<div className="mb-10 flex flex-col items-center justify-center gap-3 sm:mb-0">
<Image
src={imageUrl}
width={500}
height={500}
alt="404 illustration"
className="teste"
/>
<h2 className="text-[30px] font-[800]">Nothing Found!</h2>
<p className="select-none font-[600]">
Could not find{" "}
<span className="cursor-pointer font-[800] text-blog-text-quote underline">
<div className="my-20 flex flex-col items-center justify-center gap-4 px-6 text-center">
<div className="relative overflow-hidden rounded-2xl border border-border shadow-xl">
<Image
src={imageUrl}
width={450}
height={450}
alt="404 illustration"
className="h-auto max-w-[320px] sm:max-w-[450px] object-cover"
/>
</div>
<h2 className="text-3xl font-extrabold text-foreground sm:text-4xl">
{isFa ? "مطلب یا صفحه مورد نظر یافت نشد!" : "Nothing Found!"}
</h2>
<p className="select-none font-medium text-muted-foreground text-sm sm:text-base">
{isFa ? "آدرس " : "Could not find "}
<span className="font-bold text-blog-purple underline inline-block" dir="ltr">
/blog/{requestedPath}
</span>{" "}
!
</span>
{isFa ? " پیدا نشد." : " !"}
</p>
<Link
href="/blog"
className="rounded-md border border-blog-purple px-5 py-3 font-[500] text-blog-text-quote"
className="mt-4 rounded-full bg-blog-purple px-6 py-2.5 text-sm font-semibold text-white shadow-lg transition-all duration-300 hover:scale-105 active:scale-95"
>
Return Home
{isFa ? "بازگشت به وبلاگ" : "Return to Blog"}
</Link>
</div>
);
@@ -18,8 +18,8 @@ export default async function Header() {
};
return (
<div className="fixed z-50 flex w-full items-center justify-center bg-blog-background py-10">
<div className="top-10 flex w-[1280px] items-center justify-between px-2">
<div className="fixed z-50 flex w-full items-center justify-center bg-blog-background/90 dark:bg-zinc-950/90 backdrop-blur-md py-6 transition-colors duration-300 border-b border-border/40">
<div className="top-10 flex w-[1280px] items-center justify-between px-4">
<Link href={"/blog"}>
<div className="relative h-[30px] w-[150px] lg:h-[45px] lg:w-[225px]">
<Image
@@ -3,6 +3,7 @@
import { LocaleCookieType } from "@/app/types/types";
import { useRouter } from "next/navigation";
import { useState } from "react";
import Link from "next/link";
import { setSelectedLocale } from "@/app/lib/hooks/use-selected-locale";
@@ -56,18 +57,26 @@ export default function SelectLanguage({
: "top-[35px] opacity-0 pointer-events-none scale-95"
}`}
>
<li
<Link
href="?lang=fa"
className="w-[85%] rounded-lg py-1.5 px-3 text-center text-sm font-medium transition-colors cursor-pointer hover:bg-primary/10 hover:text-primary"
onClick={() => changeLocale("fa")}
onClick={(e) => {
e.preventDefault();
changeLocale("fa");
}}
>
فارسی
</li>
<li
</Link>
<Link
href="?lang=en"
className="w-[85%] rounded-lg py-1.5 px-3 text-center text-sm font-medium transition-colors cursor-pointer hover:bg-primary/10 hover:text-primary"
onClick={() => changeLocale("en")}
onClick={(e) => {
e.preventDefault();
changeLocale("en");
}}
>
English
</li>
</Link>
</ul>
</div>
);
+3 -3
View File
@@ -17,8 +17,8 @@ export const metadata: Metadata = {
alternates: {
canonical: "/blog",
languages: {
en: "/blog",
fa: "/blog",
en: "/blog?lang=en",
fa: "/blog?lang=fa",
"x-default": "/blog",
},
},
@@ -59,7 +59,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<div className="flex w-full flex-wrap justify-center bg-blog-background">
<div className="flex w-full flex-wrap justify-center bg-blog-background dark:bg-background text-foreground transition-colors duration-300">
<link
rel="icon"
href="/images/favicons/blog-icon.png"
+6
View File
@@ -28,6 +28,9 @@ html {
--input: 240 5.9% 90%;
--ring: 240 5.9% 10%;
--radius: 0.75rem;
--blog-bg: #F9F9Fb;
--blog-text-default: #09090b;
--blog-card-bg: #ffffff;
}
.dark {
@@ -50,6 +53,9 @@ html {
--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;
--blog-bg: #09090b;
--blog-text-default: #f4f4f5;
--blog-card-bg: #18181b;
}
}
+3 -2
View File
@@ -56,9 +56,10 @@ const config: Config = {
violet: '#FE90EC',
blue: '#27AEFF',
green: '#00DC90',
background: '#F9F9Fb',
background: 'var(--blog-bg, #F9F9Fb)',
card: 'var(--blog-card-bg, #ffffff)',
text: {
default: '#000000',
default: 'var(--blog-text-default, #000000)',
passive: '#9B9B9B',
quote: '#9283E0',
hover: '#FF5480',