Skip to content

Conversation

@ovenum
Copy link
Contributor

@ovenum ovenum commented Nov 19, 2025

The Preview section Vue component will render htmlentities like & as literal string when not decoded.
Decoding is done using Kirby Str::unhtml utility method which will also strip any html tags found.

Before
image

With this PR
image

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of HTML entities in SEO metadata, ensuring page titles, meta descriptions, and social media sharing fields display correctly in preview data.

vue will render htmlentities like & as literal string when not decoded.
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Nov 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Walkthrough

The config/sections.php file now imports Kirby\Toolkit\Str and applies HTML entity sanitization via Str::unhtml(...) to six SEO preview fields: pageTitle, title, description, ogSiteName, ogTitle, and ogDescription. Other fields remain functionally unchanged.

Changes

Cohort / File(s) Summary
HTML Entity Sanitization for SEO Fields
config/sections.php
Added Kirby\Toolkit\Str import. Wrapped six SEO-related field values (pageTitle, title, description, ogSiteName, ogTitle, ogDescription) with Str::unhtml(...) to strip HTML entities from preview data. Remaining fields (ogImage, cropOgImage, panelUrl) preserved as-is.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file modification with a consistent, repetitive pattern applied across six fields
  • Review should focus on verifying that Str::unhtml(...) is the appropriate sanitization method for these SEO fields and that no unintended side effects occur on the preview rendering

Poem

A rabbit hops through SEO fields so fine, 🐰
Stripping HTML entities—oh what divine!
Six fields now sparkle, pure and clean,
The finest sanitized preview you've seen.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Decode html entities in seo-preview section' directly and accurately describes the main change—using Str::unhtml() to decode HTML entities in SEO preview data fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee183ac and 10537f1.

📒 Files selected for processing (1)
  • config/sections.php (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
config/sections.php (1)
classes/Meta.php (2)
  • metaTitle (569-590)
  • ogTitle (595-616)
🔇 Additional comments (2)
config/sections.php (2)

6-6: LGTM!

The import is correctly placed and necessary for the Str::unhtml() calls below.


36-41: I need to verify one more critical detail about null/empty value handling.

Verification complete—code changes are appropriate and safe.

Str::unhtml() accepts null values and handles them properly in Kirby 5.x, so the null/empty value concerns are resolved. The method is correctly applied to all text fields in the preview display (pageTitle, title, description, ogSiteName, ogTitle, ogDescription), and the purpose of removing all HTML tags and encoded chars is appropriate for preview rendering to prevent XSS and display issues.

Other usages of these meta methods in config/hooks.php (lines 54–55) and config/options.php (line 34) are in different contexts (template rendering and config defaults) and do not require the same sanitization treatment.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@tobimori tobimori merged commit 6866fd8 into tobimori:main Nov 19, 2025
2 checks passed
@tobimori
Copy link
Owner

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants