News for hackers. Stuff that matters.
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Monday October 12, 2020 @11:41PM (#24762041)
All I want is a static site generator that sits in an executable file in my project's directory and doesn't require any dependencies so that I can run `./ssg build` and have all of my Markdown files interpolated into my template files and put in their own directory. I don't want to have to install all of the dependencies for Ruby or Hugo or Blades, cool as this project looks. Are there any SSGs that fill that niche?

(A Python executable would be fine since pretty much every Linux computer has Python, but I don't want to have to deal with pip).

Re:Show HN: Blades – fast static site generator written in Rust by chillfox on Tuesday October 13, 2020 @12:06AM (#24762173)
That's pretty much what hugo[1] is. Download the .tar.gz and put the executable wherever you want.

[1] https://github.com/gohugoio/hugo

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:17AM (#24762226)
Thanks. I had looked at Hugo before, but I guess I just didn't see the binary install option. (https://gohugo.io/getting-started/installing/#binary-cross-p...)
Re:Show HN: Blades – fast static site generator written in Rust by mikro2nd on Tuesday October 13, 2020 @06:26AM (#24764095)
Do save yourself some head-scratching and time, and download the hugo_extended package.
Re:Show HN: Blades – fast static site generator written in Rust by rudedogg on Tuesday October 13, 2020 @01:17AM (#24762498)
Check out https://www.getzola.org. It's a single executable. It even does syntax highlighting (without using client-side javascript).

I moved to it from Jekyll/Hugo, because I hate dealing with Ruby and dependencies like you!

Re:Show HN: Blades – fast static site generator written in Rust by b0rsuk on Tuesday October 13, 2020 @04:51AM (#24763597)
There seems to be apathy in Rust community towards using client-side js for syntax highlighting. Rust documentation and The Rust Book uses it for no good reason. Code in examples doesn't change, and the way they are highlighted doesn't change. In my opinion it clashes with the philosophy of the language - that as much as possible should be done before the code is run.

Aside from my pedantry, it causes computers to make more unnecessary computations and our civilization emits more carbon. It also affects me because I currently have an old CPU and it takes a few seconds for syntax highlighting to kick in. Every time I press "Back" in my browser, syntax highlighting needs to be recalculated as well.

Oh well, on the bright side I have an itch to scratch :-).

Re:Show HN: Blades – fast static site generator written in Rust by zimpenfish on Tuesday October 13, 2020 @05:53AM (#24763931)
> Code in examples doesn't change, and the way they are highlighted doesn't change.

I'd consider it an accessibility issue - hardcoding the syntax highlighting on the backend makes it more difficult for people to change using accessibility tools. Whereas with js-based highlighting, you can probably just change the theme and get readable output.

Re:Show HN: Blades – fast static site generator written in Rust by detaro on Tuesday October 13, 2020 @11:00AM (#24766206)
What kind of accessibility tools are you thinking of that would work with JS highlighting, but not server-generated? (Given that generally both would produce roughly the same in-browser DOM, which is what most modern accessibility tools work against)
Re:Show HN: Blades – fast static site generator written in Rust by zimpenfish on Wednesday October 14, 2020 @03:09AM (#24773975)
> that would work with JS highlighting, but not server-generated?

Mainly that JS highlighting normally works with a theme variable which is much easier to change to get, e.g., a high-contrast theme than having to muck about with 10-20 different CSS styles.

Ignoring that option, working with a known set of CSS styles in the DOM is going to be easier than dealing with John Q Random's own particular set for highlighting (assuming they haven't used the same as a popular JS highlighter, of course!)

(To my shame, whatever Hugo is now using for syntax highlighting makes an awful mess - everything is "style:color#123456", no semantic information - I'll be fixing that ASAP.)

Re:Show HN: Blades – fast static site generator written in Rust by iudqnolq on Tuesday October 13, 2020 @01:52PM (#24767946)
You seem to be describing accessibility tools for completely blind users, and I think they were describing accessibility tools for users with other sorts of disabilities. For example, someone who uses a custom stylesheet or a browser extension to make the page have higher contrast.
Re:Show HN: Blades – fast static site generator written in Rust by detaro on Tuesday October 13, 2020 @05:07PM (#24770316)
No, the question applies to those just as much.
Re:Show HN: Blades – fast static site generator written in Rust by iudqnolq on Wednesday October 14, 2020 @04:43AM (#24774498)
As far as I know, parsing the accessibility tree is primarily limited to screen readers / brail displays. Am I missing something?
Re:Show HN: Blades – fast static site generator written in Rust by detaro on Wednesday October 14, 2020 @09:28AM (#24776265)
I'm speaking of the normal DOM representation of the HTML in the page. A server-side highlighter generates HTML with css classes or styling attached that gets turned into a DOM by the browser. A JS-based highlighter edits the DOM by adding css classes or attaching styling. The in-browser representation of the end result, which a browser extension likely works with, can be the same, and how it looks like exactly is more important for their functionality than if the server or JS did it.
Re:Show HN: Blades – fast static site generator written in Rust by iudqnolq on Tuesday October 13, 2020 @07:46AM (#24764581)
If you used semantic class names you could change the theme with just css.
Re:Show HN: Blades – fast static site generator written in Rust by chrisweekly on Tuesday October 13, 2020 @09:27AM (#24765350)
apathy - neutral / "don't care"

vs

antipathy - negative / "hatred"

Re:Show HN: Blades – fast static site generator written in Rust by reificator on Tuesday October 13, 2020 @09:45AM (#24765486)
While another word or phrase would be preferable there, the GP did in fact use the word correctly.

They are claiming that the rust team uses client side JS because they don't care about the negative implications of doing so.

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @01:27AM (#24762545)
Thanks for the suggestion!

Some of the other commenters have pointed out that Hugo also has standalone binaries, I just didn't notice them last time I looked. What made you choose Zola over Hugo?

Re:Show HN: Blades – fast static site generator written in Rust by rudedogg on Tuesday October 13, 2020 @02:33AM (#24762865)
I think the main reason was the built in syntax highlighting, and simplicity. I've decided to move away from themes, and just code simple CSS by hand - so Zola kind of fits that mindset.

Hugo definitely has more features. If you think you'll want to do some complex hierarchies in your blog/site, or want a lot of themes to pick from I'd go with Hugo.

Hopefully that helps!

Edit: I think Hugo used to require Pygments (a pip package), but it looks like that's no longer the case. If it did that probably nudged me towards Zola too.

Re:Show HN: Blades – fast static site generator written in Rust by maybevain on Tuesday October 13, 2020 @02:03AM (#24762713)
I really enjoyed Zola as well. It's sufficiently simple that the learning curve is really gentle but has just enough features to cover all my needs for a static site.

Coupling it with Tailwind for styling meant that developing the theme was really smooth (slowest part of changing a template was waiting for the browser to refresh, i.e. < 1s).

Re:Show HN: Blades – fast static site generator written in Rust by thrwwayanswerq on Monday October 12, 2020 @11:57PM (#24762118)
Hugo or any go program should fit that bill since that is one of the major selling points of go

Hugo has a ton of prebuilt executables that you just have to extract and its in a single file https://github.com/gohugoio/hugo/releases

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:31AM (#24762291)
Thanks. I had looked at Hugo before, but somehow didn't see the precompiled binary as an installation option. I'll try it out.
Re:Show HN: Blades – fast static site generator written in Rust by coldtea on Tuesday October 13, 2020 @02:46AM (#24762931)
You don't need to use their precompiled binary either. It's available in brew (OS X), some Windows package manager (don't remember the name), distro packages, etc.
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @11:04AM (#24766249)
Yeah, but package managers are exactly what I want to avoid here :)
Re:Show HN: Blades – fast static site generator written in Rust by jjnoakes on Tuesday October 13, 2020 @12:01AM (#24762147)
I'm not sure why Ruby (dependencies at run time) and Go and Rust (dependencies at compile time) are both lumped together as examples of what you aren't looking for.

Doesn't go or rust give you a static executable?

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:27AM (#24762268)
It looks like Hugo does provide a static executable. I'm aware that Go is known for providing standalone binaries, but last time I checked Hugo's website I didn't notice the binary installation method [0], which is why I mentioned it as equivalent with Jekyll. I'll give it another look.

Regarding Ruby, Gems on Linux is a mess that I don't want to have to deal with for anything, but especially not for a static site generator.

Rust probably could provide a precompiled binary, but the recommended installation method for Blades involves `cargo` which is why I asked the question.

https://gohugo.io/getting-started/installing/#binary-cross-p...

Re:Show HN: Blades – fast static site generator written in Rust by cyphar on Tuesday October 13, 2020 @11:21AM (#24766439)
> Rust probably could provide a precompiled binary, but the recommended installation method for Blades involves `cargo` which is why I asked the question.

Cargo is the Rust compiler (or rather the Rust build system). After you run it, it'll spit out a binary which you can use elsewhere. If I'm reading your question correctly, this would be analogous to seeing a reference to CMake in a C++ project's README and then asking whether C++ supports precompiled binaries.

Re:Show HN: Blades – fast static site generator written in Rust by cyphar on Tuesday October 13, 2020 @11:14AM (#24766355)
Both Go and Rust do not produce static binaries by default -- they both link to glibc and a few other libraries -- but you can coerce them both to do so (though with Rust it's slightly more painful because you need to install a compiler toolchain that uses musl, but rustup makes it pretty painless).
Re:Show HN: Blades – fast static site generator written in Rust by jjnoakes on Tuesday October 13, 2020 @05:39PM (#24770618)
By static I meant go and rust dependencies bundled into the executable. Dynamically linking to libc is ok with me, any system I run on has a usable libc.
Re:Show HN: Blades – fast static site generator written in Rust by cyphar on Wednesday October 14, 2020 @12:39AM (#24773135)
Though it should be noted that when you compile such a binary on a system with a newer glibc, it will not work on a system with an older glibc. To be fair this is basically the case with C as well (you can work around it with .symver but it's kind of dodgy), but it is worth keeping in mind.
Re:Show HN: Blades – fast static site generator written in Rust by jjnoakes on Wednesday October 14, 2020 @02:17PM (#24779738)
Yes, this is true for a great many things. If I compile these pseudo-static binaries for use on multiple different linux distributions or libc versions, I compile on the oldest/lowest common denominator so that it runs everywhere I need it to.
Re:Show HN: Blades – fast static site generator written in Rust by Shared404 on Tuesday October 13, 2020 @10:09AM (#24765674)
If a dependency on Markdown/sh is acceptable, you might find this[0] to be helpful. I wrote it because I was in much the same boat.

[0] https://git.sr.ht/~evan-hoose/SSSSS

[1] http://a-shared-404.com/blog/stupid-simple-sites/

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @11:03AM (#24766236)
That looks a tad more basic than what I'd like, but I'll give it a try. Thanks for the links!
Re:Show HN: Blades – fast static site generator written in Rust by Shared404 on Tuesday October 13, 2020 @11:22AM (#24766460)
It is indeed quite basic. You should be able to replace 'markdown' with whatever renderer you want, so theoretically any sort of plaintext -> html tool should work. Alternately, if there's a more full featured markdown renderer you prefer that should work ootb.
Re:Show HN: Blades – fast static site generator written in Rust by lalaithion on Tuesday October 13, 2020 @12:00AM (#24762142)
They say "If you would like to have it included in your favourite package repository, submit an issue."
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:32AM (#24762297)
I don't know much about Rust. Can it be compiled into a standalone binary? C programs typically rely on header files and are not standalone, and Rust is (basically) C but with safeguards around memory, right?
Re:Show HN: Blades – fast static site generator written in Rust by scns on Tuesday October 13, 2020 @01:18AM (#24762502)
Yes it can when you use musl instead of glibc
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @01:24AM (#24762530)
Thanks! Where can I read more about that? I looked at musl's website, but didn't see any mention of standalone binaries on the page comparing it to glibc. [0]

[0]: https://wiki.musl-libc.org/functional-differences-from-glibc...

Re:Show HN: Blades – fast static site generator written in Rust by cyphar on Tuesday October 13, 2020 @11:16AM (#24766384)
This is more of a Rust quirk[1] than a glibc/musl thing. Glibc can be used statically (though it's not really recommended -- hence why Rust doesn't support it and requires you to use musl instead).

[1]: https://doc.rust-lang.org/edition-guide/rust-2018/platform-a...

Re:Show HN: Blades – fast static site generator written in Rust by saagarjha on Tuesday October 13, 2020 @01:40AM (#24762608)
Re:Show HN: Blades – fast static site generator written in Rust by marosgrego on Tuesday October 13, 2020 @04:22AM (#24763441)
You can do exactly this with Blades. The binary has no dependencies.
Re:Show HN: Blades – fast static site generator written in Rust by smusamashah on Tuesday October 13, 2020 @08:20AM (#24764873)
Where do you download the binary from?
Re:Show HN: Blades – fast static site generator written in Rust by marosgrego on Wednesday October 14, 2020 @03:29AM (#24774101)
You could download it from AUR: https://aur.archlinux.org/packages/blades-bin/

Or simply from GitHub releases: https://github.com/grego/blades/releases

Re:Show HN: Blades – fast static site generator written in Rust by smlckz on Tuesday October 13, 2020 @12:32AM (#24762294)
what about this?: https://rgz.ee/bin/ssg5 modify it a little bit and run!
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:40AM (#24762338)
That still has an external dependency for Markdown, but yeah, that's basically exactly what I'm looking for. I might just stick Markdown.pl in the git directory with the shell file so that dependencies aren't a problem.

Thanks!

Documentation here: https://rgz.ee/ssg.html

Re:Show HN: Blades – fast static site generator written in Rust by smlckz on Tuesday October 13, 2020 @03:05AM (#24763037)
if you like extreme minimalism : https://dataswamp.org/~solene/2019-08-26-minimal-markdown.ht...

unfortunately i don't see any license for that awk script, but still, just look at it!

Re:Show HN: Blades – fast static site generator written in Rust by CameronNemo on Tuesday October 13, 2020 @12:11AM (#24762203)
This is a really weird requirement from my perspective...
Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @12:30AM (#24762290)
Deal with a Jekyll site that sat unattended for two years and was built using the default Ubuntu ruby packages and you'll understand.
Re:Show HN: Blades – fast static site generator written in Rust by CameronNemo on Tuesday October 13, 2020 @12:51AM (#24762382)
Yeah I don't use Jekyll (I use Hugo, although have been looking for a rust option that has a smaller binary), and I rebuild my static site often enough.

But a Python venv and a requirements lockfile can alleviate a lot of the issues you seemed to have.

Seems like placing the generator directly in the repo is a little bit of an overreaction. Maybe it is all you have time/patience for, but I would not consider it a clean practice. (E.g. it would break when you switch CPU architectures, which I have done since I started my site).

Re:Show HN: Blades – fast static site generator written in Rust by bacondude3 on Tuesday October 13, 2020 @01:16AM (#24762490)
I hadn't thought of CPU architecture problems since all of my computers in the past decade or so have used the same architecture, but that's a good point.

I understand sticking the generator in the repo isn't a good practice, but I really just want a simple setup that won't have dependency problems. Probably an executable shell or Python file that doesn't draw in any dependencies would be ideal for me since those can run on pretty much any Linux computer in my experience.

Based off the recommendations here, I'll likely migrate my Jekyll site to Hugo or this one which was recommended by another commenter in the thread: https://rgz.ee/ssg.html

Right now, do you just keep Hugo in your `$PATH`? If you do that, do you need to note in your site's README which version of Hugo it should be built with, or are Hugo versions pretty backwards-compatible with each other?

Re:Show HN: Blades – fast static site generator written in Rust by CameronNemo on Tuesday October 13, 2020 @09:50AM (#24765510)
Hugo is packaged in my distro and I just roll with the updates. Never had an issue before, but it has only been a year so maybe that is not representative of long term usage.
Re:Show HN: Blades – fast static site generator written in Rust by eeZah7Ux on Tuesday October 13, 2020 @07:06AM (#24764308)
Indeed. Use a static generator properly packaged in a Linux distribution and you'll have reliability and security updates.

Use a self-contined binaries from random sources and goodbye security.

Re:Show HN: Blades – fast static site generator written in Rust by coldtea on Tuesday October 13, 2020 @02:47AM (#24762933)
Sounds very reasonable. Some Python/Ruby/JS static site generators come with dozens of dependencies...
Re:Show HN: Blades – fast static site generator written in Rust by CameronNemo on Tuesday October 13, 2020 @12:02PM (#24766826)
Dependencies which can be tracked and locked!