MWPW-201818: path-based seotech structured-data resolution - #6350
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Handles AEM preview/live URLs (e.g. *.aem.live) where the hostname doesn't match any key in the origin map. When no host-specific origins are found, resolveRepoFromOriginMap now searches all subdomains by path prefix — which is unambiguous across the map. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…obe-mwpw-201818-ticket
There was a problem hiding this comment.
Pull request overview
Updates Milo’s SEOTECH structured-data integration to resolve the correct repo via path-prefix matching against the public AEM origin map (instead of the previous sha256/IMS-bucket flow), with additional testing toggles.
Changes:
- Implement path-based repo resolution using the public origin map +
structuredDataUrlTemplate, including pathname canonicalization and unknown-host path fallback (AEM preview/live). - Enable structured-data injection via
?seotech-structured-data=onby loading the SEOTECH module when the query param is present. - Update SEOTECH unit tests and README for the new structured-data resolution flow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
libs/features/seotech/seotech.js |
Adds origin-map-based structured-data resolution, enablement helper, and updated logging context. |
libs/utils/utils.js |
Loads SEOTECH when seotech-structured-data=on is set via query param (in addition to metadata / video url). |
test/features/seotech/seotech.test.js |
Extends unit coverage for canonicalization, query-param enablement, origin map fetch + repo resolution, and AEM host fallback. |
libs/features/seotech/README.md |
Documents the new structured-data resolution source and the query-param toggle. |
Comments suppressed due to low confidence (1)
libs/features/seotech/seotech.js:217
append()passesJSON.stringify(obj)as a string intocreateTag(). In this codebasecreateTag()inserts string content viainsertAdjacentHTML, which parses HTML; if the fetched JSON-LD contains</script>it could break out of the tag and inject markup. Set the script content viatextContent(ortext) instead so the payload is treated as plain text.
const append = (obj, className) => {
if (!obj) return;
const attributes = { type: 'application/ld+json' };
if (className) attributes.class = className;
const script = createTag('script', attributes, JSON.stringify(obj));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const seotechStructuredDataParam = new URL(window.location.href).searchParams | ||
| .get('seotech-structured-data') === 'on'; |
| Metadata Properties: | ||
|
|
||
| - `seotech-structured-data`: `on` to enable SEOTECH lookup | ||
| - `?seotech-structured-data=on`: test-only query param override to force SEOTECH lookup on a page | ||
|
|
|
This PR has not been updated recently and will be closed in 7 days if no action is taken. Please ensure all checks are passing, https://github.com/orgs/adobecom/discussions/997 provides instructions. If the PR is ready to be merged, please mark it with the "Ready for Stage" label. |
|
Waiting for related CDN release |
Resolves: MWPW-201818
Test URLs: