Congrats! You have successfully uploaded your files to Pinata and they are now on the IPFS network. However, despite pointing your .json file (which contains all the metadata regarding your NFT) to your content, your images aren’t appearing on the NFT marketplace.
Metadata Example (OpenSea)
Why are my NFTs not appearing?
If your metadata IPFS link ends with .json, then you might have missed a step. Some smart contracts will include a file extension that will be tacked onto the token ID in combination to the Base URI. Such a feature would like like this in the smart contract:
string public baseExtension = “.json”
As a result your tokenURI is appearing as:
ipfs://<directory_hash>/<tokenID>.json
However, there are other smart contracts that do not have this extension and instead just have the file name and the “.json” file extension is removed completely, which would look like this:
ipfs://<directory_hash>/<tokenID>
How can I fix this?
There are two options to fix this:
Rewrite the smart contract to include the .json file extension modifying
Remove the file extensions from your json files
Because IPFS is immutable, and removing the file extensions would change the CID, you would need to re-upload them and update the base URI. If your smart contract does not have a function to do that then you would need to redeploy the smart contract.
Here are some methods to remove the file extensions from your json files!
For Mac OS users:
Go to Finder on your Mac
Click “Finder” at the top in the toolbar
Click “Settings”
Click “Advanced”
Check the box that says “Show all filename extensions”
Uncheck the box that says “Show warning before changing an extension”
Go to the folder on your computer which contains all your .json files
Highlight all the files
Right click and select “rename”
Under “Find” enter “.json” (leave “Replace with” blank)
Click “rename”
DON’T FORGET: Now that you’ve removed the .json file extensions, you will need to re-upload your files to the IPFS network!
For PC users:
Open your "File Explorer Options"
Click the "View" tab
Uncheck the box for "Hide extensions for known file types"
Click "Apply"
Go to your "Command Prompt"(CMD) Note: Be sure you're under your administrator login. To be sure, you can "right click" on the app itself and select "Run as administrator"
Go back to your folder which contains your files and copy the file path
Go back to your CMD window and type:
cd <paste copied link here>
Hit "enter" and you will now be inside of that folder directory
Type:
ren *.json *.
Hit "enter"
DON’T FORGET: Now that you’ve removed the .json file extensions, you will need to re-upload your files to the IPFS network!