Skip to content

Canonicalize same-origin absolute URLs in companion markup to WordPress routes #1325

Description

@chubes4

Problem

Same-origin absolute page URLs inside generated companion content remain pointed at the source website instead of resolving to routes in the materialized WordPress site.

Native navigation links in the Busy Bears import are correctly localized, for example /get-a-quote/ and /contact/. The generated footer companion block from the same source still contains links such as:

<a href="https://www.busybearscleaning.com/get-a-quote">Get a Quote</a>

Because the URL is absolute, asset/reference canonicalization treats it as external even though it matches the captured site's canonical origin and a declared artifact page. Clicking the fallback content escapes the imported WordPress site.

Reproduction

  1. Capture https://www.busybearscleaning.com/ through Route studio create --from URLs through Data Liberation studio#3952.
  2. Compile and materialize the four-route artifact.
  3. Inspect native header navigation and generated footer companion markup.
  4. Observe localized WordPress URLs in the native blocks and original source-host URLs in the companion content.

Acceptance

  • Carry the captured site's canonical origin into route resolution without embedding source-specific policy.
  • Resolve same-origin absolute document URLs to declared artifact routes before plan validation and materialization.
  • Preserve query strings and fragments.
  • Leave genuinely external origins unchanged.
  • Apply the same route semantics to normal markup, escaped companion HTML, and route-bearing generated block attributes.
  • Add generic positive coverage for root, nested, query, and fragment URLs plus negative coverage for external and ambiguous origins.
  • Recompile Busy Bears with no busybearscleaning.com page links in materialized companion content.

Related: #220. Evidence tracker: Automattic/studio#3952.

AI assistance

OpenAI GPT-5.6 Sol via OpenCode compared native and generated route output in the serialized Busy Bears homepage and drafted this issue. Chris Huber remains responsible for the report.

Activity

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