Skip to content

fix: copy server-side section metadata, publish via helix-tools-website - #125

Merged
dylandepass merged 3 commits into
mainfrom
fix/section-metadata-server-side
Oct 7, 2026
Merged

dylandepass merged 3 commits into
mainfrom
fix/section-metadata-server-side

Conversation

@dylandepass

@dylandepass dylandepass commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Copying a block from the blocks plugin dropped its Section Metadata on sites that process section metadata on the server (rendering version 2). This PR fixes that and changes where releases are published.

Section metadata

With rendering version 2, helix-html-pipeline applies the Section Metadata table to the section itself (Style becomes classes, Id becomes the id, everything else becomes data-*) and removes the section-metadata block from the .plain.html. The blocks plugin only looked for a section-metadata block, so there was nothing to copy.

When there is no section-metadata block, copy now rebuilds the table from the section's class, id and data-* attributes (getSectionMetadataFromAttributes). A section-metadata block is still preferred and handled as before. This covers block, default content, compound and multi-section block, and template copies.

Rebuilt rows use the attribute name as the key (section-margin, not Section Margin), and image and link values come back as absolute URLs. A round trip through helix-html-pipeline's extractSectionMetadata reproduces the original class, id and data attributes.

Hosting

  • The release workflow now opens the RC PR against adobe/helix-tools-website (same tools/sidekick/library path) instead of adobe/helix-website.
  • AppModel.libraryHost was hardcoded to https://www.hlx.live/tools/sidekick/library, so loading index.js from tools.aem.live would still have fetched the plugins and locales from the old copy. It is now derived from the URL the library was loaded from, so the plugins and locales always come from the same place as index.js. When hosting the library yourself, host the whole directory (index.js, plugins/, locales/, events/, utils/).
  • The README examples point to tools.aem.live. Existing installs keep working as long as the copy on www.aem.live and www.hlx.live stays in place.

Before the first release from this change, Access-Control-Allow-Origin needs to be configured for /tools/sidekick/library/** on tools.aem.live.

Tests

  • Unit tests for the rebuild and for block, default content and page copy with both legacy and server-side markup.
  • Integration tests using a real .plain.html from an affected site (testimonial-carousel.js fixture), copying through both the block list and the details panel.
  • Tests for libraryHost.

24 tests in blocks.test.js and 2 in franklin-library.test.js already fail on main with a current Chrome. The 24 use shadowRoot.querySelector(':scope ...'), which no longer matches in shadow roots. This PR does not change that, and the new tests do not use that selector.

Sites that process section metadata on the server (rendering version 2) no longer have a section-metadata block in the .plain.html, so Copy dropped it. Rebuild the Section Metadata table from the section's class, id and data attributes when there is no block, and leave the legacy path unchanged.
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dylandepass
dylandepass force-pushed the fix/section-metadata-server-side branch from 4f786b7 to 5286b75 Compare October 6, 2026 20:42
Open the release PR against adobe/helix-tools-website at the same tools/sidekick/library path, derive libraryHost from the library's own URL so plugins and locales load from wherever it is hosted, and point the README at tools.aem.live.
Chrome no longer matches :scope in shadow root queries, so query sp-sidenav directly. The test plugin host on hlx.live is now blocked, so load it from aem.live.
@dylandepass
dylandepass force-pushed the fix/section-metadata-server-side branch from 5286b75 to 2e88c57 Compare October 7, 2026 13:23
@dylandepass
dylandepass merged commit 8ff9823 into main Oct 7, 2026
5 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.

1 participant