Getting Hugo and Neocities to play nice with IPFS

Posted on
publishing decentralized

Neocities 1 supports IPFS 2 archiving by default. Versions of the entire site are stored by hash. Hash values are available at URLs of the form: https://neocities.org/site/<site>/archives.

Under a default Hugo 3 configuration, a DNS-based base URL will be set in the Hugo configuration (typically baseURL in config.toml). This will cause Hugo to generate all links and URLs in the site as absolute URLs incorporating the full DNS path. This, unfortunately, makes the site IPFS-unfriendly, as every link will take the user off of their IPFS node.

To correct the issue, we set baseURL to simply /, and set relativeURLs to true. This results in a site with all links generated using relative paths, making the site IPFS-friendly.

To view the site on IPFS, use an IPFS node, such as the public ipfs.io using a URL of the form: <ipfs node>/ipfs/<site archive hash>. An example URL using this technique is https://ipfs.io/ipfs/QmfMTegxtFR9EMf4NPGnrLXunE1XsdEkmUUReJtNdatmPS/.


  1. https://neocities.org/ Neocities [return]
  2. https://ipfs.io IPFS is the Distributed Web [return]
  3. https://gohugo.io Hugo | A Fast and Flexible Website Generator [return]