15 lines
305 B
TypeScript
15 lines
305 B
TypeScript
import { headers } from "next/headers"
|
|
|
|
import { getLang } from "@/i18n/serverContext"
|
|
|
|
export function appendSlugToPathname(slug?: string) {
|
|
const pathname = headers().get("x-pathname")
|
|
const lang = getLang()
|
|
|
|
if (!pathname || !slug) {
|
|
return null
|
|
}
|
|
|
|
return `/${lang}${pathname}/${slug}`
|
|
}
|