fix(SW-3075): Fixed issue where URLs rendered differently in source HTML in compared to client
Approved-by: Matilda Landström
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import { headers } from "next/headers"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
import { getPathname } from "./getPathname"
|
||||
|
||||
export async function appendSlugToPathname(slug?: string) {
|
||||
const headersList = await headers()
|
||||
const pathname = headersList.get("x-pathname")
|
||||
const lang = await getLang()
|
||||
const pathname = await getPathname()
|
||||
|
||||
if (!pathname || !slug) {
|
||||
if (!slug) {
|
||||
return null
|
||||
}
|
||||
|
||||
return `/${lang}${pathname}/${slug}`
|
||||
return `${pathname}/${slug}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user