From b29cdf8d8a73353f1ee4f1befea30b0d1c264184 Mon Sep 17 00:00:00 2001 From: Julien Nahum Date: Fri, 12 Jan 2024 15:59:01 +0100 Subject: [PATCH] No follow for non-production env --- client/app.vue | 4 ++++ client/pages/forms/[slug]/index.vue | 2 +- client/pages/templates/[slug].vue | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/app.vue b/client/app.vue index cdbe80b..8762056 100644 --- a/client/app.vue +++ b/client/app.vue @@ -44,10 +44,14 @@ export default { components: {}, setup() { + const config = useRuntimeConfig() useOpnSeoMeta({ title: 'OpnForm', description: 'Create beautiful forms for free. Unlimited fields, unlimited submissions. It\'s free and it takes less than 1 minute to create your first form.', ogImage: '/img/social-preview.jpg', + robots: () => { + return config.public.env === 'production' ? null : 'noindex, nofollow' + } }) useHead({ titleTemplate: (titleChunk) => { diff --git a/client/pages/forms/[slug]/index.vue b/client/pages/forms/[slug]/index.vue index 6fd6770..920c03d 100644 --- a/client/pages/forms/[slug]/index.vue +++ b/client/pages/forms/[slug]/index.vue @@ -132,7 +132,7 @@ useOpnSeoMeta({ } return (form && form.value.cover_picture) ? form.value.cover_picture : null }, - robots () { + robots: () => { return (form && form.value.can_be_indexed) ? null : 'noindex, nofollow' } }) diff --git a/client/pages/templates/[slug].vue b/client/pages/templates/[slug].vue index 8936240..37e85d9 100644 --- a/client/pages/templates/[slug].vue +++ b/client/pages/templates/[slug].vue @@ -275,7 +275,7 @@ useOpnSeoMeta({ if (!template || !template.value) return null return template.value.image_url }, - robots() { + robots: () => { if (!template || !template.value) return null return template.value.publicly_listed ? null : 'noindex' }