Site design: the CTA keeps its address, the basket page is optional
Instead of a separate booking page setting, booking links lead to the header button's own address again, and the basket page falls back to that address when it isn't set. Site design warns when the basket's page isn't published or has no Checkout block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
ec1156b1fa
commit
f20d6777ab
6 changed files with 30 additions and 53 deletions
|
|
@ -61,12 +61,10 @@ export type UpcomingCalendarBlockData = {
|
|||
export type HeaderGlobal = {
|
||||
logo: { url: string; alt: string };
|
||||
navLinks: { label: string; href: string }[];
|
||||
/** The header button. It leads to the booking page; `href` is only read on sites set up before there was one. */
|
||||
ctaButton: { label: string; href?: string };
|
||||
/** The header button. Its address is also where hero buttons without one and "Book another" lead. */
|
||||
ctaButton: { label: string; href: string };
|
||||
homePage: string;
|
||||
/** Slug of the page with the Shop block: the header button, hero buttons without an address and "Book another" lead here. */
|
||||
bookingPage?: string;
|
||||
/** Slug of the page with the Checkout block: the basket in the header and "view basket" lead here ('' = the booking page). */
|
||||
/** Slug of the page with the Checkout block: the basket in the header and "view basket" lead here ('' = the CTA button's address). */
|
||||
basketPage?: string;
|
||||
};
|
||||
|
||||
|
|
@ -89,22 +87,15 @@ export const defaultHeader: HeaderGlobal = {
|
|||
{ label: 'About', href: '/about' },
|
||||
{ label: 'Services', href: '/services' }
|
||||
],
|
||||
ctaButton: { label: 'Book Now' },
|
||||
ctaButton: { label: 'Book Now', href: '/book' },
|
||||
homePage: 'home',
|
||||
bookingPage: 'book',
|
||||
basketPage: ''
|
||||
};
|
||||
|
||||
/**
|
||||
* Addresses of the booking and basket pages. Sites set up before these
|
||||
* settings existed sent everything to `/book` or the button's own address,
|
||||
* so that is still where they lead until a page is picked in Site design.
|
||||
*/
|
||||
/** Where booking (the CTA button's address) and the basket (the basket page, else the same address) are. */
|
||||
export function shopLinks(header?: Partial<HeaderGlobal> | null) {
|
||||
const legacy = header?.ctaButton?.href?.match(/^\/([a-z0-9-]+)\/?$/)?.[1];
|
||||
const booking = header?.bookingPage || legacy || 'book';
|
||||
const basket = header?.basketPage || booking;
|
||||
return { booking: `/${booking}`, basket: `/${basket}` };
|
||||
const booking = header?.ctaButton?.href || '/book';
|
||||
return { booking, basket: header?.basketPage ? `/${header.basketPage}` : booking };
|
||||
}
|
||||
|
||||
export const defaultFooter: FooterGlobal = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue