I am creating a blogging website where all the user information is stored on ethereum blockchain. I am thinking to store the blog itself on ipfs and later when the blog reader wants to read a blog , the blog should be retrieved from ipfs and should be displayed in the format that the blog was posted. I am unable to find a way to do this. Can someone help me??
I think you have to make this.
You can post content to ipfs with
ipfs put [filename], but you have to have the IPFS server then online. Posting on IPFS doesn’t mean it will be available forever like posting to the blockchain, you have to share it so to speak.
Well from that you get the hash, which is then used to access it. You can then include the data in your blog so that it fetches data from https://ipfs.io/ipfs/hashThatYouReceived and if the browser is compatible with IPFS it will go through it and not through ipfs.io.
An another way is to use the HTTP-header x-ipfs-path and a Location HTTP header, where you send the IPFS hash to the client and it will use IPFS if it’s IPFS aware, otherwise it will just HTTP redirect to the new location.