Skip to content

SilverStripe 6 Compatibility & Code Audit#79

Open
tomstgeorge wants to merge 4 commits into
syntro-opensource:6from
tomstgeorge:6
Open

SilverStripe 6 Compatibility & Code Audit#79
tomstgeorge wants to merge 4 commits into
syntro-opensource:6from
tomstgeorge:6

Conversation

@tomstgeorge

@tomstgeorge tomstgeorge commented Apr 10, 2026

Copy link
Copy Markdown

SilverStripe 6 Compatibility & Code Audit

This Pull Request consolidates all necessary changes to ensure the module is fully compatible with SilverStripe 6, while also performing a thorough cleanup of legacy workarounds and standardizing the codebase.

Key Changes

🔧 SilverStripe 6 Compatibility

  • Template Rendering Fix: Replaced the broken $SchemaState.JSON variable (which returns empty in SS6) with $SchemaAttributesHtml in SEOAnalysisField.ss. This correctly serializes the data-schema and data-state required by the React components.
  • Namespace Standardization: Standardized all instances of Syntro\SEO to Syntro\Seo (unified lowercase "eo") across all PHP files, YAML configurations, translation files, and documentation to meet SS6 requirements.
  • PHP 8.2 Support: Fixed dynamic property deprecations and updated the meta-field configuration logic.

🧪 SEO Analysis Improvements

  • URL Normalization Patch: Added lowercase normalization and whitespace trimming to the analyseURL check, ensuring more reliable focus keyword detection in URL segments.
  • Robust DOM Extraction: Replaced layout-dependent innerText with standard textContent across all analysis scripts (analyseH1Title.js, analyseContentWordCount.js, analyseContentFocus.js) for consistent results in all DOM environments.
  • Workaround Cleanup: Removed all "brute-force" regex fallbacks and redundant query selector logic that were previously added as temporary workarounds for the template rendering issue.

📦 Development & Assets

  • Externalized React: Updated the build configuration to externalize react and react-dom, preventing multiple versions from being loaded in the CMS.
  • Fresh Asset Build: Included a fresh production build in client/dist reflecting all the above changes.
  • Absolute Link Resolution: Ensured $analysisLink always resolves to an absolute URL in the CMS to prevent fetch failures.

Verification

  • Verified consistent namespace resolution across all module subdirectories.
  • Confirmed that the React components correctly receive props from the serialized schema attributes.
  • Audited all analysis scripts for clean, specification-compliant DOM parsing.

This commit consolidates all changes required for SilverStripe 6 compatibility, including:
- Template Fix: Replaced $SchemaState.JSON with $SchemaAttributesHtml to correctly render data-schema and data-state for React components.
- Namespace Standardization: Unified all namespaces to Syntro\Seo (lowercase 'eo') across PHP, YAML, and documentation.
- PHP 8.2 Compatibility: Fixed dynamic property deprecations and updated getSchemaStateDefaults.
- Analysis Improvements:
    - Replaced 'innerText' with 'textContent' in analysis scripts for more reliable DOM parsing.
    - Added normalization (lowercase + trim) to the URL analysis check.
    - Removed redundant 'brute-force' regex fallbacks once the root cause (template rendering) was fixed.
- Link Resolution: Ensured absolute URLs are used for fetch requests in SEOExtension.
@tomstgeorge tomstgeorge changed the title Externalize React/ReactDOM and add en-US locale fallback to support Silverstripe 6 SilverStripe 6 Compatibility & Code Audit Apr 10, 2026
@tomstgeorge
tomstgeorge marked this pull request as ready for review April 10, 2026 22:20
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.

1 participant