Skip to content

Commit df0ef47

Browse files
committed
feat: add nofollow,noindex meta for auth-enabled pages
1 parent 2dd4b1f commit df0ef47

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

daras_ai_v2/meta_content.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,25 @@ def robots_tag_for_page(
217217
is_root = pr and pr.saved_run == sr and pr.is_root()
218218
is_example = pr and pr.saved_run == sr and not pr.is_root()
219219

220-
match page.tab:
221-
case RecipeTabs.run if is_root or is_example:
222-
no_follow, no_index = False, False
223-
case RecipeTabs.run: # ordinary run (not example)
224-
no_follow, no_index = False, True
225-
case RecipeTabs.examples:
226-
no_follow, no_index = False, False
227-
case RecipeTabs.run_as_api:
228-
no_follow, no_index = False, True
229-
case RecipeTabs.integrations:
230-
no_follow, no_index = True, True
231-
case RecipeTabs.history:
232-
no_follow, no_index = True, True
233-
case RecipeTabs.saved:
234-
no_follow, no_index = True, True
235-
case _:
236-
raise ValueError(f"Unknown tab: {page.tab}")
220+
if not page.is_user_authorized(None):
221+
# nofollow & noindex if page is not open for anonymous users
222+
no_follow, no_index = True, True
223+
else:
224+
match page.tab:
225+
case RecipeTabs.run if is_root or is_example:
226+
no_follow, no_index = False, False
227+
case RecipeTabs.run: # ordinary run (not example)
228+
no_follow, no_index = False, True
229+
case RecipeTabs.examples:
230+
no_follow, no_index = False, False
231+
case RecipeTabs.run_as_api:
232+
no_follow, no_index = False, True
233+
case RecipeTabs.integrations:
234+
no_follow, no_index = True, True
235+
case RecipeTabs.history:
236+
no_follow, no_index = True, True
237+
case RecipeTabs.saved:
238+
no_follow, no_index = True, True
237239

238240
parts = []
239241
if no_follow:

0 commit comments

Comments
 (0)