Im onto my own NFT project, and now Im about to set the BaseURI. The actual json file will be linked in the future.
Even though its only one token which will be minted by the SmartContract, I created an own folder for this token. Now that I have the CID I dont know how to set it as an BaseURI.
Should I set it with a gateway:
baseURI = https://ipfs.io/ipfs/CID
Should I set it only with the IPFS-protocol:
baseURI = ipfs://CID
Or should I just set the CID and do the linking in the front-end:
baseURI = CID
Also the tokenURI function computes the URI by concatenating the baseURI with the tokenID:
URI = baseURI + tokenID
The problem with that is, that I need a "/" between the baseURI and the tokenID.
Should I add the slash to the baseURI or is there another best practice.
And how do I add the ".json" suffix.
There is also the possibility of setting the CID of the token directly as baseURI, what do you think about that?
I'm pretty sure opensea docs state that your baseUri should be defined as "ipfs://{hash}" and you can just put the "/" on the end. "ipfs://{hash}/"
Useful: https://docs.opensea.io/docs/metadata-standards && HashLips on YT
Thank you for your fast reply. If I add the "ipfs://" and I want to show the link on a website, should I replace it in front-end with "https://gateway/ipfs/". And should the ".json"-suffix also be added in front-end? Because if tokenURI just returns "ipfs://folderCID/tokenID", the json file will not be found because of the .json suffix missing.
Exactly, and this is also the link I would have to persist into the NFT dont I? But in the form of "ipfs://CID/tokenID". I just wonder how OpenSea is able to get the metadata file out of it, because there isnt the ".json"-suffix.