Jekyll with Crystal

I was playing around with Jekyll - https://jekyllrb.com/ - to see if it would work with truffleruby, and started wondering if it could be used with Crystal. I suspect not, currently.

The other most popular static page generator is Hugo - https://gohugo.io/ - which is done in Go. Its claim to fame is fast site code rendering.

Jekyll could be Crystal’s Rails if it could make rendering Jekyll sites comparably as fast as Hugo.

3 Likes

Jekyll can’t run on Crystal, it’s a highly complex Ruby application.

But I’ve been working on a Jekyll-compatible static site generator written in Crystal: https://github.com/straight-shoota/criss
It’s nowhere near feature-complete, but already does a pretty good job for basic sites.

3 Likes

I think this would be a great community project for people to work on.

At minimum, we could start off mimicking the features and compatibility of Jekyll, to attract it users.
Once multi-threading is nailed down, it can be used to reduce the build times, and be faster than Hugo.

Though I’m not a web developer per se, I’d become involved in this project, to learn Crystal and web development better.

Again, this could be a something to give Crystal mindshare within the application world, since most people aren’t programmers but app users (including programmers).

1 Like

Even without multithreading, it’s already much faster than Ruby. ;)

The comparison I was making with Hugo, which is written in Go - https://gohugo.io/

It’s claim to fame is its blazing fast build times, which they use against Jekyll/Ruby.
I was making the point a Jekyll-like/Crystal combination would remove that claim.


If it’s a static site generator, what does the “fastest” claim is about? Compiling the static site? Running it?

Because if it’s compiling it, and that requires crystal to compile something, I don’t think that’ll be faster than Go.

1 Like

Or is it a tool that compiles HTML/Markdown/etc. into static HTML, and that tool needs to be fast? If that’s the case then yes, it could end up being faster than Go but I think it will depend on the libraries too. For example markd is fast but I don’t know if it’s faster than existing markdown parsers written in Go (maybe!).

Yes, they both take the elements used to create the website and builds a final site html image that can be uploaded to a site and served.

Jekyll/Ruby now is currently the most popular because it’s easier to develop site (with plugins and gems) and github will host, for free, your Jekyll sites, if you develop it on their platform.

A Jekyll/Crystal doesn’t have to be absolutely faster than Hugo/Go, it just needs to (and will) be much faster than using Ruby. The more compatible it is to Jekyll/Ruby the more attractive and easier to use it will be to Jekyll/Ruby users.

Just as Rails created mindshare for Ruby (which some people still don’t know the difference between) a Jekyll-like/Crystal combination can do the same for Crystal.

And since web development is a significant commercial enterprise, this could attract more developers and $$ to Crystal.

Crystal needs at least one something it is widely seen to be useful for, and this seems a natural fit.

Here’s a list of most (all) known static site generators, and platform information.

2 Likes

Fast compile time of the site is primordial for success. In the technical aspect a good file system watcher I believe is still needed (and not something that loop every second on the directory). Maybe binding to https://github.com/Axosoft/nsfw could be a route.

Also the Markdown or whatever rendered is used. Dependency tracking and live reloading. Otherwise it will not temp someone outside Crystal land.

The community of a site generator built on X is not be the same as a community for X. Whatever X is.

The current decision on using Jekyll is not because of Ruby. But of course I would love to have a native and efficient alternative built on Crystal.

Also, there were some static site generators done in the past: https://github.com/trans/brite.cr is one.

1 Like

Didn’t know about Brite, but it appears to be dead/dormant (no activity in 3 years).

But, again, my main point is this (and I’m not trying to get into religious wars on the details of doing this or that) - a good, and easy to use and understand static site generator, could be Crystals Rails!

It’s about marketing Crystal by showing its usefulness than its technical superiority!

Since CLI are a good fit for Crystal, a static site generator should be a good fit. Yes, I agree there.
I personally found Hugo interesting because of that same thing you think a Crystal version should shine :slight_smile:

Yes, exactly.

Ruby took off because of Rails.

Elixir broke off from Ruby, and used Erlang to tackle websites tackling 100s of thousands of concurrent connections, for commerce sites.

Rust was begat by Mozilla to squash memory leaks in Firefox, and spread from there.

Swift was created by Apple to be a better Objective C to write IOS apps in.

There’s an origin story, or best use focus, for these languages (in the minds of programmers).

Crystal needs something comparable too.

What is Jekyll? I visited their website but am still not sure what it is?

It’s a static site builder. It generates static HTML files from your templates. You deploy only the static files so there’s no runtime needed. Super useful for blogs, marketing sites, and other sites that don’t need dynamic content.

Interesting. What’s the difference between just using a blog template and editing the static html files?

If you edit the HTML yourself, you have to copy/paste any changes you make to the layout across every file. Also, the generators can also handle things like sitemaps, RSS feeds, blog index pages, etc.

Free online Jekyll Conference, today Sunday, September 22, 2019.
10am - 1:30pm PST (Pacific Time USA)

https://jekyllconf.com/

Interesting response to my question in Jekyll forum - Is Crystal use on Jekyll roadmap?

One of Jekyll’s strong points is that it is extensible with plugins written in Ruby — a language with high readability and simpler learning curve — allowing users willing to add or enhance functionality to do so with minimal investment.

Looks like a description of Crystal :smile: almost

I don’t think Crystal supports any form of plugins…