Canonical URL Pagination Test Page

This page serves as a demonstration of how edge computing, specifically a Cloudflare Worker, can be used to modify HTML content before it is delivered to the client. In this example, the Worker updates the page’s canonical URL by appending any query parameters present in the request URL.

Example URLs:

https://ethangrant.co.uk/canonical-test?p=1 - Does not apply on the first page.
https://ethangrant.co.uk/canonical-test?p=2 - Canonical updated.
https://ethangrant.co.uk/canonical-test?p=3&otherparam=false - Only ‘p’ param is applied to canonical
https://ethangrant.co.uk/canonical-test?otherparam=false - Only ‘p’ param is applied to canonical

After navigating to one of the pages listed above, access the page source using the browser's developer tools or the "View Page Source" option. You can then review the canonical URL changes.

This site uses document-based authoring; however, the same principle also applies to AEM.