fix(SW-2754): Fixed issue where server rendered html included faulty links
Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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}`
|
||||
}
|
||||
Reference in New Issue
Block a user