feat(SW-187): use custom title for links

This commit is contained in:
Pontus Dreij
2024-09-10 10:23:15 +02:00
parent f79c88d07e
commit 84fb10aa2c
2 changed files with 5 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ query GetFooter($locale: String!) {
all_footer(limit: 1, locale: $locale) {
items {
main_links {
title
open_in_new_tab
link {
href
@@ -35,6 +36,7 @@ query GetFooter($locale: String!) {
secondary_links {
title
links {
title
open_in_new_tab
pageConnection {
edges {
@@ -52,6 +54,7 @@ query GetFooter($locale: String!) {
}
}
tertiary_links {
title
open_in_new_tab
link {
href

View File

@@ -318,6 +318,7 @@ const validateInternalLink = z
export const validateLinkItem = z
.object({
title: z.string(),
open_in_new_tab: z.boolean(),
link: validateExternalLink,
pageConnection: validateInternalLink,
@@ -325,7 +326,7 @@ export const validateLinkItem = z
.transform((data) => {
return {
url: data.pageConnection?.url ?? data.link?.href ?? "",
title: data.pageConnection?.title ?? data.link?.title,
title: data?.title ?? data.link?.title,
openInNewTab: data.open_in_new_tab,
isExternal: !!data.link?.href,
}