Skip to main content

Linking from Walrus Sites to External URLs

Walrus Sites serves content stored on Walrus through a portal. All relative URLs in your site resolve against the onchain site object. Anything outside that object, such as third-party pages, APIs, CDN assets, and other Walrus Sites, requires an absolute URL.

Standard HTML <a> tags with absolute https:// URLs work without any special configuration. The portal does not intercept or rewrite absolute URLs in rendered HTML.

<a href="https://example.com">Visit Example</a>

When a user clicks this link, the browser navigates directly to https://example.com. The portal is not involved after the initial page render.

To open an external link in a new tab:

<a href="https://example.com" target="_blank" rel="noopener noreferrer">
Open in new tab
</a>

Including rel="noopener noreferrer" is a standard security practice when using target="_blank".

Each Walrus Site resolves through a subdomain on a portal host. To link from one Walrus Site to another, use the full subdomain URL.

<a href="https://OTHER_SITE_NAME.wal.app">Other site</a>

Replace OTHER_SITE_NAME with the subdomain name of the site you link to.

You can also link to a site using its Base36-encoded Sui object ID directly through the portal:

<a href="https://BASE36_OBJECT_ID.wal.app">Site by object ID</a>

Replace BASE36_OBJECT_ID with the Base36-encoded Sui object ID of the site.

Using Base36 object IDs produces stable links that do not break if the SuiNS name associated with the site changes.

How to load external resources​

External assets such as images, fonts, and scripts must use absolute URLs.

TypeExampleResolves to
Relative (within site)/assets/logo.pngBlob inside site object
Absolute externalhttps://cdn.example.com/logo.pngExternal host
Protocol-relative//cdn.example.com/logo.pngAvoid (behavior depends on portal scheme)

Avoid protocol-relative URLs (//example.com). Their behavior depends on the scheme of the portal serving the site, which can produce unexpected results.

The portal serves pages with standard browser security policies, so cross-origin resource sharing (CORS) restrictions apply. The external host must allow cross-origin requests for assets to load.

caution

Do not use relative paths to reference offchain resources. A path like ../external/resource resolves within the Walrus Site object and returns a 404 if the resource does not exist there.

Common patterns​

The following examples show typical outbound links from a Walrus Site. Replace the uppercase placeholders, such as YOUR_ORG, YOUR_REPO, and OBJECT_ID, with your own values.

Linking to a GitHub repository​

<a href="https://github.com/YOUR_ORG/YOUR_REPO">Source code</a>

Linking to Sui Explorer for an object​

<a href="https://suiexplorer.com/object/OBJECT_ID">View on Sui Explorer</a>

Loading a font from a CDN​

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter&display=swap">

Linking between pages within the same site​

<a href="/about">About</a>
<a href="/blog/post-1">Read post</a>

Relative links within the same site resolve against the site object and do not require absolute URLs.