From b0d1720d9258c5b2b982e57799a4c7c7e0ada798 Mon Sep 17 00:00:00 2001 From: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com> Date: Tue, 15 Aug 2023 06:14:09 +0530 Subject: [PATCH] feat: Allow / disallow SEO indexing on booking pages (#10566) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Omar López --- apps/web/pages/[user].tsx | 8 ++ apps/web/pages/[user]/[type].tsx | 5 ++ .../web/pages/settings/my-account/general.tsx | 20 +++++ apps/web/public/static/locales/en/common.json | 2 + .../bookings/components/BookerSeo.tsx | 7 +- packages/lib/test/builder.ts | 1 + .../migration.sql | 2 + packages/prisma/schema.prisma | 82 ++++++++++--------- .../server/middlewares/sessionMiddleware.ts | 1 + .../routers/loggedInViewer/me.handler.ts | 1 + .../loggedInViewer/updateProfile.schema.ts | 1 + 11 files changed, 88 insertions(+), 42 deletions(-) create mode 100644 packages/prisma/migrations/20230803132959_adds_field_for_seo_indexing_checking/migration.sql diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsx index a19b89cbf8..c99b464202 100644 --- a/apps/web/pages/[user].tsx +++ b/apps/web/pages/[user].tsx @@ -36,6 +36,7 @@ import { ssrInit } from "@server/lib/ssr"; export function UserPage(props: InferGetServerSidePropsType) { const { users, profile, eventTypes, markdownStrippedBio, entity } = props; + const [user] = users; //To be used when we only have a single user, not dynamic group useTheme(profile.theme); const { t } = useLocale(); @@ -82,6 +83,10 @@ export function UserPage(props: InferGetServerSidePropsType
@@ -214,6 +219,7 @@ export type UserPageProps = { theme: string | null; brandColor: string; darkBrandColor: string; + allowSEOIndexing: boolean; }; users: Pick[]; themeBasis: string | null; @@ -276,6 +282,7 @@ export const getServerSideProps: GetServerSideProps = async (cont away: true, verified: true, allowDynamicBooking: true, + allowSEOIndexing: true, }, }); @@ -315,6 +322,7 @@ export const getServerSideProps: GetServerSideProps = async (cont theme: user.theme, brandColor: user.brandColor, darkBrandColor: user.darkBrandColor, + allowSEOIndexing: user.allowSEOIndexing ?? true, }; const eventTypesWithHidden = await getEventTypesWithHiddenFromDB(user.id); diff --git a/apps/web/pages/[user]/[type].tsx b/apps/web/pages/[user]/[type].tsx index 4f3d96c2b1..2ef5eb038f 100644 --- a/apps/web/pages/[user]/[type].tsx +++ b/apps/web/pages/[user]/[type].tsx @@ -30,6 +30,7 @@ export default function Type({ booking, away, isBrandingHidden, + isSEOIndexable, rescheduleUid, entity, duration, @@ -41,6 +42,7 @@ export default function Type({ eventSlug={slug} rescheduleUid={rescheduleUid ?? undefined} hideBranding={isBrandingHidden} + isSEOIndexable={isSEOIndexable ?? true} entity={entity} /> { label: nameOfDay(localeProp, user.weekStart === "Sunday" ? 0 : 1), }, allowDynamicBooking: user.allowDynamicBooking ?? true, + allowSEOIndexing: user.allowSEOIndexing ?? true, }, }); const { @@ -124,6 +125,7 @@ const GeneralView = ({ localeProp, user }: GeneralViewProps) => { getValues, } = formMethods; const isDisabled = isSubmitting || !isDirty; + return (
{ )} />
+ +
+ ( + { + formMethods.setValue("allowSEOIndexing", checked, { shouldDirty: true }); + }} + /> + )} + /> +
+