Skip to content

fix(content): keep a collapsed FAQ's answers when URL import finds it next to the post body #1381

Closed

Description

@cihan-gyk

Description

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

  1. added a commit that references this issue on Oct 23, 2026
    b709c38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions