From 66c88487607ed199a40744cde3043daa8b308254 Mon Sep 17 00:00:00 2001 From: Poyraz <78071274+poyrazavsever@users.noreply.github.com> Date: Sat, 27 Jun 2026 15:19:57 +0300 Subject: [PATCH] fix(links): fix static file routing issues for RSS and resume files --- components/links-content.tsx | 89 +++++++++++++++++++++++++----------- components/site-navbar.tsx | 32 +++++++------ 2 files changed, 81 insertions(+), 40 deletions(-) diff --git a/components/links-content.tsx b/components/links-content.tsx index 603953b..382845f 100644 --- a/components/links-content.tsx +++ b/components/links-content.tsx @@ -2,7 +2,7 @@ import { Icon } from "@iconify/react"; import { Link } from "@/i18n/routing"; -import { useTranslations } from "next-intl"; +import { useLocale, useTranslations } from "next-intl"; import { useMemo, useState } from "react"; import { Avatar, @@ -60,6 +60,7 @@ function formatHref(href: string) { export function LinksContent() { const t = useTranslations("Links"); const tNav = useTranslations("Nav"); + const locale = useLocale(); const [activeCategory, setActiveCategory] = useState("all"); const [query, setQuery] = useState(""); @@ -141,7 +142,7 @@ export function LinksContent() {
{SOCIAL_LINKS.map((item) => ( - - + ))}
- {TOP_ICON_LINKS.map((item) => ( - + {TOP_ICON_LINKS.map((item) => { + const href = item.id === "cv" ? `/resume-${locale}.pdf` : item.href; + const isStaticOrExternal = item.external || item.id === "rss" || item.id === "cv"; + const CardContent = (
@@ -177,13 +174,35 @@ export function LinksContent() { variant="small" className="truncate text-xs text-muted-foreground" > - {formatHref(item.href)} + {formatHref(href)}
- - ))} + ); + + return isStaticOrExternal ? ( + + {CardContent} + + ) : ( + + {CardContent} + + ); + })}
@@ -223,14 +242,10 @@ export function LinksContent() {
- {filteredItems.map((item) => ( - + {filteredItems.map((item) => { + const href = item.id === "cv" ? `/resume-${locale}.pdf` : item.href; + const isStaticOrExternal = item.external || item.id === "rss" || item.id === "cv" || href.endsWith(".xml") || href.endsWith(".pdf"); + const CardContent = (
@@ -251,21 +266,43 @@ export function LinksContent() { variant="small" className="mt-1 truncate text-xs text-muted-foreground" > - {formatHref(item.href)} + {formatHref(href)}
- - ))} + ); + + return isStaticOrExternal ? ( + + {CardContent} + + ) : ( + + {CardContent} + + ); + })} {filteredItems.length === 0 ? ( diff --git a/components/site-navbar.tsx b/components/site-navbar.tsx index 6307a99..eb19e3f 100644 --- a/components/site-navbar.tsx +++ b/components/site-navbar.tsx @@ -3,7 +3,7 @@ import { Icon } from "@iconify/react"; import dynamic from "next/dynamic"; import { Link, usePathname } from "@/i18n/routing"; -import { useTranslations } from "next-intl"; +import { useLocale, useTranslations } from "next-intl"; import { LanguageSwitcher } from "@/components/language-switcher"; import { useState } from "react"; import { @@ -47,6 +47,7 @@ export function SiteNavbar() { const [searchOpen, setSearchOpen] = useState(false); const shortcut = useKeyboardShortcutLabel(); const t = useTranslations("Nav"); + const locale = useLocale(); const isActiveLink = (href: string) => { if (href === "/") return pathname === "/"; @@ -56,19 +57,22 @@ export function SiteNavbar() { return (
- {TOP_ICON_LINKS.map((item) => ( - - - - ))} + {TOP_ICON_LINKS.map((item) => { + const href = item.id === "cv" ? `/resume-${locale}.pdf` : item.href; + return ( + + + + ); + })}