📝 update breadcrumbs , nav for mobile and homepage translations
All checks were successful
PR Checks / lint-and-build (pull_request) Successful in 21s
Build and Deploy Next.js Blog to Production / 🔍 Code Quality Checks (push) Successful in 16s
Build and Deploy Next.js Blog to Production / 🏗️ Build and Push Docker Image (push) Successful in 1m4s
Build and Deploy Next.js Blog to Production / 🚀 Deploy to Production (push) Successful in 55s

This commit was merged in pull request #17.
This commit is contained in:
RJ
2025-12-05 16:25:56 +02:00
parent bba507a7e8
commit 6adb3a6979
14 changed files with 411 additions and 57 deletions

View File

@@ -1,5 +1,6 @@
import { Breadcrumbs } from '@/components/layout/Breadcrumbs'
import { getPostBySlug } from '@/lib/markdown'
import { getTranslations } from 'next-intl/server'
interface BreadcrumbItem {
label: string
@@ -7,28 +8,19 @@ interface BreadcrumbItem {
current?: boolean
}
function formatDirectoryName(name: string): string {
const directoryNames: { [key: string]: string } = {
tech: 'Tehnologie',
design: 'Design',
tutorial: 'Tutoriale',
}
return directoryNames[name] || name.charAt(0).toUpperCase() + name.slice(1)
}
export default async function BlogPostBreadcrumb({
params,
}: {
params: Promise<{ slug: string[] }>
}) {
const t = await getTranslations('Breadcrumbs')
const { slug } = await params
const slugPath = slug.join('/')
const post = await getPostBySlug(slugPath)
const items: BreadcrumbItem[] = [
{
label: 'Blog',
label: t('blog'),
href: '/blog',
},
]
@@ -36,8 +28,9 @@ export default async function BlogPostBreadcrumb({
if (slug.length > 1) {
for (let i = 0; i < slug.length - 1; i++) {
const segmentPath = slug.slice(0, i + 1).join('/')
const dirName = slug[i]
items.push({
label: formatDirectoryName(slug[i]),
label: t(dirName) || dirName.charAt(0).toUpperCase() + dirName.slice(1),
href: `/blog/${segmentPath}`,
})
}

View File

@@ -1,11 +1,16 @@
'use client'
import { Breadcrumbs } from '@/components/layout/Breadcrumbs'
import { useTranslations } from 'next-intl'
export default function BlogBreadcrumb() {
const t = useTranslations('Breadcrumbs')
return (
<Breadcrumbs
items={[
{
label: 'Blog',
label: t('blog'),
href: '/blog',
current: true,
},