feat(SW-187): use custom title for links
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user