---
title: "Adi (@adicom) | Hashnode"
description: "Adi (@adicom) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@adicom"
---

@adicom

# Adi

@adicom · Joined April 2022

[Website](https://www.trizen.xyz/)

## Comments

[when I just run the code rewrite it works rewrite the canonical link with route www.domain.com/p/test.html. I can't seem to run concurrently, is there maybe something wrong with my route settings? I've also changed my codes and still the same still can't rewrite the canonical link.](https://hashnode.com/posts/how-to-lazy-load-images-with-an-edge-worker/60fa225862e20b58c1c9156f/comment/625693e0b32ddd968bbed2c7#reply-625701cfd448c6c43fbf1a55)

Reply · Article · Apr 13, 2022 · [How to Lazy Load Images with an Edge Worker](https://hashnode.com/posts/how-to-lazy-load-images-with-an-edge-worker/60fa225862e20b58c1c9156f)

[Hello, I want to change the blogger permalink /p/test.html to /test-page/ and also canonical link and other links. but still can't rewrite the canonical and other links. first code, with route settings like this: www.domain.com/test-page\* addEventListener("fetch", event => { return event.respondWith(fetch("https://www.domain.com/p/test.html")) }) the second code, and the route settings are like this \*.domain.com/test-page\* const OLD\_URL = "https://www.domain.com/p/test.html"; const NEW\_URL = "https://www.domain.com/test-page"; async function handleRequest(req) { const res = await fetch(req) return rewriter.transform(res) } class AttributeRewriter { constructor(attributeName) { this.attributeName = attributeName } element(element) { const attribute = element.getAttribute(this.attributeName) if (attribute) { element.setAttribute( this.attributeName, attribute.replace(OLD\_URL, NEW\_URL) ) } } } const rewriter = new HTMLRewriter() .on("link", new AttributeRewriter("href")) .on("meta", new AttributeRewriter("content")) addEventListener("fetch", event => { let url = event.request.url event.respondWith(handleRequest(url) .catch(err => new Response(err.toString(),{status:500}))) })](https://hashnode.com/posts/how-to-lazy-load-images-with-an-edge-worker/60fa225862e20b58c1c9156f/comment/625693e0b32ddd968bbed2c7)

Comment · Article · Apr 13, 2022 · [How to Lazy Load Images with an Edge Worker](https://hashnode.com/posts/how-to-lazy-load-images-with-an-edge-worker/60fa225862e20b58c1c9156f)
