HUGO

A Hugo version for IPFS

Hi,

Sorry, I am not a programmer so might get terms wrong.

I am interested in moving one or more of my sites to the distributed web. IPFS appears to be the way forward for this, but may not yet be ready to use.

Witting a static website… will that is hard work without something like Hugo.

People are fudging a combination of Hugo and IPFS by using relativeURLS=true in the config file. and only using IPFS to point to the folder containing the website. But it appears to me that a true, implementation of IPFS would be using the hash or CID file names as links and inclusions.

This would be VERY heard by hand what with hashes changing every time a file is changed even by one character, but for Hugo, live compiling every time, creating files on the fly and the like. it should not be impossible for it to start at the end branches, creat any files needed hash them into IPFS names, and then move up one level and do the same, but now linking to the hash of any file being referenced.

The whole website and all resources and files therein all being fully IPFS compliment.

Does anyone know if anything like this is being worked on?

Thanks.

As per the IPFS documentation over here:

CIDs are based on the content’s cryptographic hash. That means:

  • Any difference in the content will produce a different CID and
  • The same content added to two different IPFS nodes using the same settings will produce the same CID .

IPFS uses the sha-256 hashing algorithm by default, but there is support for many other algorithms.

Hugo already ships with template functions that could make such calculations, however it is not currently possible to automatically configure a Page’s Permalink into the value of the Cryptographic Hash for that Page.

The documentation describes the acceptable values for permalink configuration

I think that you could try opening an issue on GitHub with your request.

I can’t pretend to understand what exactly is required, but to me, if it’s something “simple” as “we need frontmatter tag hash with a value that is calculated from the content and then used to address the resulting page”, here is how I would “hack” this in:

frontmatter of a content file (index.md):

---
...
slug: 1234567890abcdef
...
---

The slug value is used to create the filename in the end.

Then I always have a script running before and after I run hugo for creation. In the pre-script I would add a section that traverses the content directory and calculates these hashes and replaces whatever is in the slug line. So when hugo runs the filenames are properly done.

Then I would create a shortcode template for something like {{< permalink path=“folder/index.md” >}} that creates the permalink and use it consequently. In this shortcode something like the following will create the right link:

<a href="/some/other/paths/{{ with .Site.GetPage $path }}{{ .Slug }}{{ end }}">link</a>

It’s a hack. But it might work.

Thanks onedrawingperday,

It would be so great to see this implemented. Still not sure we have a good answer for human-readable links to a site from outside like search engines, or how to enable people to have useful links form an old page that old links point to.

The more you look the more challenges you see.

Thanks David,

Wooow… going beyond my brain.

I thin this version of Hugo would need to also be able to generate the hashing of the files.

No. The method described by @davidsneighbour would not be a workable solution in the long run.

In any case, I have opened an issue at the main repository of Hugo on GitHub, as I think that your request has merit @ajdrapper

I am closing this topic in favor of the GitHub issue. Feel free to contribute there.

2 Likes