Adding Support for Micropub Endpoint
Recently, I have talked about restructuring the URLs of my website and adding IndieAuth so I could use my domain as my main online identity to login into services. Along those lines, I came across Micropub. In their own words:
The Micropub protocol is used to create, update and delete posts on one’s own domain using third-party clients.
So it’s basically a simple common protocol that could let any website get updated using an arbitrary CMS (Content Management Software) or application that supports it. I really enjoyed the spec and there’s suggestions and issues being worked on.
What I’ve been trying to do is to implement this on my own website. There aren’t many open source server implementations unfortunately. However, I understand the reason: most of them are highly specific for their author’s website and so is the one I’m building.
I’ve been building it using express.js and I’ve already published two different nom modules:
Apart from that, I’m mostly calling APIs directly: I’m relying a lot on some of @aaronpk’s modules, such as Compass and XRay . Those are, btw, awesome modules and you should try them out if you’re interested in this subject.
The current status is that I pass almost all the tests provided by micropub.rocks even though I’m not satisfied with the solution I’ve come across. Why?
First of all, if you’ve been following me for more time, you might’ve came across an old blog post talking about how I am using Hugo to generate my website. But that is not the only “problem” of this: I’m also using IPFS to store my website for the folks using it. So there’s quite a few constraints.
Build Speed and Complexity
It needs to build fast so every time I post something new, I don’t need to wait a few seconds. Hugo is known for being fast, but I’ve about ~950 posts on this website right now divided between replies, notes, likes and articles that I’ve imported.
It takes ~1s to build on my machine and ~3s on my server which is definitely not ideal. I don’t know why this is taking so much time.
In addition, the complexity of my themes is really big and that might be caused by the not-so-high flexibility of Hugo and Go templates. There are template languages that are more flexible and static website generators that allow plugins, such as Jekyll — not an option since I need speed — or 11ty.
All links must be relative and the site must be 100% static. Any dynamic stuff must be done on the client-side so it plays well with IPFS and other distributed technologies that don’t support server-side rendering.
Personally, I would love to have a better search engine working for myself, to find bookmarks, to find old replies. Tags are definitely not enough for this and search engines take quite a few time to get updated with all the new content. And… do I want all of the content on search engines anyways?
Solutions and Thoughts
Obviously I’ve been thinking a bit about this and some conclusions were drawn to my mind. So let me “dump” them here in a rational way.
I thought about just moving out of a static website generator and have some more dynamic website. With that, I would be able to have more powerful queries and basically solve the problems from the “Static” point I mentioned above.
Not to mention that if the pages were built on the fly with server-side generation, I would not require full builds every time. But… is it worth it? That way I couldn’t cache it on IPFS. What if I cached the website once per day and updated my static site on IPFS? These are just some questions I’m throwing here.
Another interesting option here would be to continuously run
hugo —watch. That way Hugo would be watching for updates and only the required pages would be rebuilt. Should I do that?
Two solutions: one would be what I said on the previous point and just make the website server-side rendered. It would open an immense sea of opportunities and things I could do.
Or, another interesting way of putting things, build JSON indexes that could be used by client-side server engines such as Lunr. However, as the website would become bigger and bigger, I am pretty sure the indexes would become bigger and bigger and the load times slower and slower.
Well, these are just some problems I need to solve before continuing and I would personally love your take on them. What should I do in your opinion? Please lemme know!