Lesson: Create a Simple Webpage and Add It to IPFS
This lesson shows you how to create a simple webpage and add it to IPFS. Once you are able to do this you can make your webpages as beautiful or complex as you would like, and add them to IPFS using the same basic commands.
Prerequisites
To do the steps in this lesson you must:
Install and Initialize IPFS on your local machine
Goals
After doing this Lesson you will be able to
Create a simple webpage and add it to IPFS
Steps
Step 1: Start the IPFS daemon
If the IPFS daemon is not running already, then start the daemon now
Step 2: Create webpage directory and content
Create a new webpage directory in your user's home directory.
Download this nice kitten image using ipfs:
Using a text editor, create a file called index.html
and copy/paste the following content:
Save index.html
in the simple-webpage
directory and close the text editor. If you like, you may open index.html
in the browser to see the webpage.
This simple webpage only has 2 files, index.html
and cat.jpg
. Now you will add the simple-webpage
directory to IPFS:
You should see output like the following:
Notice that you used the command ipfs add
with the -r
option to tell IPFS to recursively add the contents of the directory.
Explanation
You can work on a webpage locally and then add it to IPFS. When you add your webpage directory content to IPFS, you use ipfs add
with the -r
option to recursively add all of the files within the directory to IPFS.
Next Steps
Proceed to the next lesson to learn how to View Your Webpage with IPFS and Publish to IPNS
Last updated