You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(content): keep a collapsed FAQ's answers when URL import finds it next to the post body #1381
URL import (Content Editor › New content › Optimize › Page URL) drops the answers of a collapsed FAQ that sits next to the post body instead of inside it.
A common layout is <main> with the post body, followed by an FAQ section. The questions are headings, and the answers are hidden until opened.
server/src/lib/page-content.js picks the post body as the text area, because it holds the visible paragraphs, and removes hidden blocks outside that area (around the HIDDEN selector, lines ~276–282 at the time of writing).
The root (<main>) still keeps the FAQ's questions, so the imported draft has questions with no answers.
Proposed behavior
Keep a hidden block when it is inside the root and follows a heading (h2–h6), which is the accordion's shape. Hidden blocks elsewhere (menus, cookie banners, etc.) are still removed. Blocks with hidden="until-found" keep working as today.
Suggested approach
Adjust the hidden-block removal in page-content.js.
Add a test to server/src/lib/page-content.test.js with an FAQ section after the text block: the questions and their hidden answers both come through, and a hidden non-FAQ block outside the text area is still dropped.
Please start after #1370 is merged. It changes how the same file picks the page's title H1. Branch from the latest main.
Run npm run format && npm run lint && npm test from server/ before opening the PR. See CONTRIBUTING.md.
Activity
fix(content): keep a collapsed FAQ's answers when URL import finds it…