Link to another IPFS CID

I have an IPFS website and I want to link to a different CID.
How do I link to a different CID?
Or different unstoppable domain?

(without using gateways)

Can you please provide more information. It’s hard to give an answer without more specifics on what and how you’re doing thiongs.

Ok so I was able to get it to link from 1 CID to another. But I was NOT able to using unstoppable domains or eth domains.

website.x (unstoppable domain)

<a href="Website.x">This is a domain</a>

<a href="ipfs://QmSnxLh6pQNBTgM7GttuBWUs222k6BDpPbqd3uxZMJiVp2">This is CID</a>

please i want to develop on IPFS, how can I solve this?

In a perfect world (the future), just use “ipfs://” and “ipns://” URLs.

In the current world, that only works if the user is using a browser that directly supports it (like Brave), or the IPFS Companion extension which provides support for those URL types.

For everything else (using a local node as a gateway, or using a public gateway), you have to parse the base of your current page to extract the address of the gateway and then construct a new URL from it containing the CID you want to link to.

It is a fairly simple thing to do to write a JS function that takes a new base32 CID and returns the appropriate URL based on the current base (location).

Read the following for more info on the possible patterns: