Search code examples
twittermeta-tagsipfs

How can I use IPFS images as twitter card image?


I want to be able to allow clients to set there own twitter card data with image sourced from there own site or from IPFS. as a test I made a page with the following meta tags(copied from a market)

<meta name="twitter:card" content="summary_large_image" /> 
<meta name="twitter:site" content="https://digiassetX.com/market/#DCbR5qt3BcozuSsu49MeocXvfHkEESf5NL" /> 
<meta name="twitter:title" content="Altar of DigiByte" /> 
<meta name="twitter:description" content="Worlds first MineCraft world DigiAsset.  Take a look around the infinit minecraft world but first hike up to the DigiByte alter where treasures await." /> 
<meta name="twitter:image" content="https://cloudflare-ipfs.com/ipfs/QmXLXP4VBxvAMJtsAhqaPt6koazBpQSzha5EDqpMhdDtKf" />

It shows everything except the image correctly. I suspect the problem is twitter won't get data from cloudflare is there another IPFS gateway they can get it from or some thing I need to change?


Solution

  • You can switch to one of the public gateways listed here. My personal preferences are dweb.link and storage.link by NFT.storage.