Skip to content

fix: prevent v14 "page is not valid" condition error for styleguide robots meta - #45

Merged
konradmichalik merged 1 commit into
mainfrom
44-fix-robots-condition-parse-error
Jun 19, 2026
Merged

fix: prevent v14 "page is not valid" condition error for styleguide robots meta#45
konradmichalik merged 1 commit into
mainfrom
44-fix-robots-condition-parse-error

Conversation

@konradmichalik

@konradmichalik konradmichalik commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Resolves Repeated "Variable \"page\" is not valid" SyntaxError from traverse(page, "doktype") conditions (TYPO3 v14) #44: on TYPO3 v14 the [traverse(page, "doktype") == …] setup condition repeatedly threw SyntaxError: Variable "page" is not valid (ERROR-level log noise), and the noindex,nofollow rule was silently skipped.
  • Root cause: Symfony ExpressionLanguage validates variable names at parse time. The include-tree condition matcher only registers page when the calling factory passes one; any page-less setup-TypoScript build (non-standard callers) fails to parse the whole expression.
  • Fix: drop the include-tree condition entirely and scope the robots meta with a render-time stdWrap if/isInList guard on page:doktype. No condition is parsed during include-tree builds, so it cannot fail in any caller context (v12/v13/v14).

Verified (local v14, .Build/14)

  • Styleguide page → <meta name="robots" content="noindex,nofollow">
  • Regular page → no robots meta (scoping intact)
  • v14 log → no is not valid parse errors

Note

The TCEFORM.tsconfig conditions are left unchanged: they run as Page TSconfig, where PageTsConfigFactory always registers page (empty when off-page), so they never parse-fail.

Changes

  • Configuration/TypoScript/setup.typoscript - replace [traverse(page, "doktype")] condition with a stdWrap if guard on the robots meta

Summary by CodeRabbit

  • Refactor
    • Optimized conditional logic for search engine indexing configuration by restructuring the metadata rules application based on page type classification.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eadda6f5-460d-42d5-bd6e-22606d29a382

📥 Commits

Reviewing files that changed from the base of the PR and between eff4836 and 8f2f512.

📒 Files selected for processing (1)
  • Configuration/TypoScript/setup.typoscript

📝 Walkthrough

Walkthrough

In Configuration/TypoScript/setup.typoscript, the condition controlling page.meta.robots is rewritten from an inline [traverse(page, "doktype") == 1754310721] TypoScript condition to a page.meta.robots.if block using value = page:doktype and isInList = 1754310721.

Changes

TypoScript robots condition fix

Layer / File(s) Summary
Rewrite page.meta.robots condition to .if block
Configuration/TypoScript/setup.typoscript
Replaces the inline [traverse(page, "doktype") == 1754310721] condition wrapping page.meta.robots with a page.meta.robots.if block that reads value = page:doktype and checks isInList = 1754310721, avoiding the Symfony ExpressionLanguage Variable "page" is not valid error in TYPO3 v14's IncludeTreeConditionMatcherVisitor.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A rabbit hopped by and spotted the flaw,
traverse(page, "doktype") broke TYPO3's law. 🐇
So I swapped it for .if, neat and clean,
isInList now checks the doktype unseen.
No more ERROR-level logs in the queue —
noindex, nofollow applies as it's due! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing a problematic include-tree condition with a stdWrap guard to fix the v14 compatibility issue.
Linked Issues check ✅ Passed The code changes fully address the linked issue #44 by moving from a page-context-dependent condition to a render-time stdWrap approach, eliminating SyntaxError parse failures and ensuring robots meta is properly applied.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the reported condition parse error; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 44-fix-robots-condition-parse-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@konradmichalik
konradmichalik merged commit ce58d42 into main Jun 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeated "Variable \"page\" is not valid" SyntaxError from traverse(page, "doktype") conditions (TYPO3 v14)

1 participant