Live data from Hacker News

Rewriting my blog in Rust for fun and profit

jonashietala.se

1–10 of 116 posts

Re: Rewriting my blog in Rust for fun and profit

#3
This is a cool idea, I've wanted to find a Rust project for a while and regenerating my own site (which uses jekyll) might not be a bad idea too. Every time I come back to mine it never works because it always complains about the wrong ruby library versions being installed.

Re: Rewriting my blog in Rust for fun and profit

#4
I did the same thing a couple years ago [0]. It's not the most elegant and my blog is miniscule, but it was a fun project and also born out of frustration with the existing site generators. I structured it as the source sitting next to the site contents, so from a fresh computer (with Rust installed), it's as straightforward as `cargo build`.

I think the best thing about this approach (writing your own generator) is that it really lets you build your site / content exactly the way you want to. Don't need categories and tags? Don't add them to begin with. Want to add an RSS feed? No problem, just add it. Want to do some fancy image compression and processing in the pipeline? No problem; you're the boss. It sounds simple but it really frees you up to write / generate your site however you want.

0: https://github.com/hamaluik/blog.hamaluik.ca

Re: Rewriting my blog in Rust for fun and profit

#5
Fun project! I really resonate with this part

> But I haven’t used Haskell in years, and the overhead for me to add slightly more complex things to the site is quite large

I’m starting to come around to the idea that it might be better to avoid shiny fun things in favor of having most of my active projects use the same stack, or at least the same few languages.

I’ve got a blog in Jekyll (with some Ruby-based customizations), a bunch of stuff in JavaScript, some TypeScript, an app in Elixir & Phoenix, a (desktop) app in Rust, and some Rails to maintain. For me personally, Elixir is the odd one out: I learned enough to build that app, and I really enjoyed Elixir, but that knowledge was fleeting because I haven’t needed to touch the code very much. I have to relearn how Phoenix works in order to make changes. As much as it pains me to say this, I kind of wish it was in TypeScript or something, just to reduce the mental overhead. (but then, that’s a whole other can of worms because of how piecemeal things are in the Node ecosystem, so I’d end up having to learn a web framework and an ORM and some other libraries, which feels like the sort of knowledge that might be even more fleeting!)

Re: Rewriting my blog in Rust for fun and profit

#6
I also rewrote my blog's static site generator to a bespoke one (in Dart in my case), largely for performance reasons. Prior, I was using Jekyll and Pygments. Jekyll and Pygments are really slow. My new site generator is literally 100x faster, and I did, like, zero real optimization work. In fact, it can rebuild my entire blog and every post from scratch faster than Jekyll's watch mode (with caching set up properly) could rebuild a single page.

Re: Rewriting my blog in Rust for fun and profit

#7
I've been trying to make a cool static site generator numerous times. Well, yes, it actually is a quite fun thing to tinker with, but I've found myself struggling to decide on what do I want to see in the final app and what I do not; what features might be needed by other users and what features might be an overkill. So I ultimately went with Zola[1] and encourage you to try it too! Aaaand it is written in Rust, too. It's available in Alpine Linux's repos so it's trivial to set up a CI/CD to compile your blog.

[1] https://www.getzola.org/

Re: Rewriting my blog in Rust for fun and profit

#8
post #5

Fun project! I really resonate with this part > But I haven’t used Haskell in years, and the overhead for me to add slightly more complex things to the site is quite large I’m starting to come around to the idea that it might be better to avoid shiny fun things in favor of having most of my active projects use the same stack, or at least the same few languages. I’ve got a blog in Jekyll (with some Ruby-based customiz…

> As much as it pains me to say this, I kind of wish it was in TypeScript or something, just to reduce the mental overhead.

If you once knew how Elixir works (syntactically), then you will be able to quickly bounce back. If comparing TypeScript with Phoenix, then you would have to relearn your in TS written functionality, in contrast to relearning Phoenix.

I don't see how it being TS would help much tbh. I think what matters much more is, whether your past self left good comments and wrote readable code.

Re: Rewriting my blog in Rust for fun and profit

#9
It’s refreshing to see a front-page Rust piece that just nails it on promoting the language.

It cites concrete examples of where the rubber really meets the road: e.g. Cargo as a one-stop-shop for platform insensitive, “just works” build and dep management.

It acknowledges that it’s ok for fun and novelty to be features, which it is!

It steers well clear of A >> B nonsense. No preachy TED talk about memory safety.

It’s respectful of the value that other languages provide in their respective niches.

This is how to sell Rust. It’s novel and fun but also pragmatic and industrial grade! And if you’re into X, that’s cool too!

Re: Rewriting my blog in Rust for fun and profit

#10
Ah yes, one of my favorite projects in a newly learned language: Make a blog, based on plain text files, maybe markdown, maybe something else.

But since I have done that, I feel that many existing site generators are bloated, probably, because they cover scenarios, which I would not want on my blog anyway.

Post reply on HN