Publish a site
A site is a folder of static files (HTML, CSS, JavaScript, images…) stored on the network and served at an address of its own. Publishing one takes two signatures in your wallet.
You need: a connected wallet with some testnet IOTA, and a folder with your site.
1. Prepare the folder
- Put an
index.htmlat the top of the folder: it is the home page. Without it, the app warns you and the site has no home page. - Optionally, a
404.html, served for paths that do not exist. - Optionally, a
ws-resources.jsonwith the name of the site, HTTP headers, routes (for single-page apps), redirects and files to ignore. It is not published itself. - Everything else in the folder is published, subfolders included, except what
ws-resources.jsonignores. Leave out what is not part of the site (node_modules, sources, drafts) withignore. - Every file is public, and the whole folder can have up to 2,000 files and 256 MB in the app.
Paths keep their names: images/logo.svg is served at /images/logo.svg. A folder without
extension in a path, like /docs/, serves /docs/index.html.
2. Choose the folder
In Publish a site, drag the folder onto the dashed area, or press or choose a folder and pick it. The app reads it (Reading the folder…) and shows:
- the folder's name, and N files · size (the ignored ones are not counted);
- Files, which unfolds a table with the path, size and type of each file. The type
is the
content-typethe site will serve, taken from the extension unlessws-resources.jsonsets another; - a warning if there is no
index.htmlat the top.
Choose another folder starts over with a different one.
3. Fill in the form
| Field | Meaning |
|---|---|
| Publish as | A new site (the default), or one of your existing sites to update. Leave it on A new site the first time. See Update a site. |
| Site name | The name of the Site object, shown in My sites and in wallets. It is filled in from site_name in ws-resources.json or, without it, from the folder's name. Up to 200 characters. |
| Duration (days) | For how many days to store the files, 1 to 53 (the default is 10). The buttons 1 week, 1 month and Maximum fill it in. The help line under it says the date the site would expire. On testnet an epoch is one day, so the days are epochs; the help line gives the epoch too. |
| Estimated cost | What the storage will cost, computed exactly as the network will charge it. The line under it says how much is storage; the rest is gas, mostly a refundable deposit of about 0.005 IOTA per file. If a deleted blob left paid space in your wallet, the app uses it and says so (N quilts use storage space already paid in your wallet). |
object_idWhen the ws-resources.json of the folder carries the object_id of one of your sites (the
command line writes it there), the app shows a notice: The ws-resources.json of this folder says
it is your site "…", with a button to update that site. It does not choose it by itself,
because any downloaded folder could carry the ID of one of your sites. Leave it as it is to
publish a new site.
4. Publish
Press Publish. The help line reminds you: approve two transactions in your wallet.
- The app packs the files into quilts (a quilt holds up to 66 files) and encodes them in your browser. Quilt encoded (blob ID …) appears for each one.
- The first transaction registers and pays for all the quilts at once: storage for the epochs you chose plus the write fee. The quilts are blobs owned by you.
- The slivers go straight to the storage nodes. Storage nodes confirmed N shards appears for each quilt as they confirm.
- The second transaction certifies the quilts and creates the
Siteobject in your wallet, with one resource per file. Site object written in 1 transaction(s) closes the list.
A very large site may need an extra transaction for the Site; the app tells you.
5. Open your site
The result box shows Site "…" published, with:
- the address of the site,
https://<site ID in base36>.iotastorage.com/, as a link, with a button to copy it. It shows the site once it has been reviewed: until then, a Pending review page (see Review, and the terms of use for what a site may not show); - the Site ID (
0x…), the object in your wallet, with a link to it in the IOTA explorer; - how many files it has, until <date> (epoch N), and what it cost (storage and gas);
- Open site, and Add a name, to give it an address with your IOTA Names name. See Give your site a name.
The site also appears in My sites. From there you can update it, renew or destroy it.
What it costs
- Storage for the quilts: a few thousandths of an IOTA for a small site, as for any blob (see Store a file). Small files cost much less in a site than one by one, because a quilt pays the fixed metadata once.
- Gas, which includes a deposit of about 0.005 IOTA per file, held on IOTA while the resource exists and returned when you destroy the site (or remove the file in an update).
- On testnet, the example site of the project (6 files) costs about 0.035 IOTA to publish, almost all of it deposit.
Good to know
- The site is available as long as its files are paid. Renew it before it expires: one purchase covers at most 53 days on testnet (53 epochs). See Renew and destroy a site.
- Publishing the same folder again without choosing a site creates a second site with the same files (the quilts have the same blob IDs, so nothing is uploaded again, but the new site has its own resources and deposits). To change a site, update it.
- The address in base36 is long. Give the site a readable one with an IOTA Names name.
- For sites with more than 2,000 files or 256 MB, or to publish from a script, use the command line.