Hacker News new | past | comments | ask | show | jobs | submit login

What's the best static site generator that meets the following requirements:

a) Doesn't use node.js.

b) Has built-in syntax highlighting for C#, SQL, PowerShell and Rust at a minimum.

c) Is also good at "photo journals" or galleries.

I played around with Hugo, but the themes were ugly and it was very weak at managing pictures associated with an entry instead of the entire site.




I’m a big fan of Jekyll, and it meets your A and B requirements out of the box. Hugo lit a fire under them with regard to build speed, and the 4.x line is a huge speed boost. It does syntax highlighting with Rouge, and the default Markdown engine is Kramdown.

I never found a solution for requirement C that I liked, so I’ve been building my own. It’s still very rough and not exactly in shape to publish, but its capabilities already by far exceed my previous solution: https://github.com/okeeblow/DistorteD

I left my WIP site running (‘jekyll serve’ using WEBrick) on my laptop and I’m going to bed, so these links may get hugged or just crash and become unavailable, but here you can get an idea of what I’ve been playing with for multi-image layouts: https://beta.cooltrainer.org/distorted/

And on the index page is a random smattering of some other media types I’ve been testing, like support for image-rendering SVGs, TTFs, and old DOS-codepage Nfos, mbedding PDFs, etc: https://beta.cooltrainer.org/

Anyway, big Jekyll fan. Try it out :)


You might check out mine!! Been waiting ages to share this.

You create a folder of markdown files, you have 2 template HTML files (index and blog post), and you run my program (MMSSG). It compiles the index page with a list of all the posts, then renders the HTML for each markdown file into a separate blog post. That's it. Handles the linking and everything for you.

It’s all open source and the templates are already made, modify to your heart’s content. It's also REALLY simple, so should be easy to understand my code.

It’s what I used to generate my blog, and there’s instructions in the readme to get going quickly :) It's super simple and I really love it. This is my post about it, and the github link:

https://jacobkania.com/2020-01-18-the-great-blog-project/

https://github.com/jacobkania/mmssg

--

Edit: Just reverted a couple of commits from a WIP plugins feature that I got bored of and quit, and created new versions of the binaries (Linux and Windows are untested). Also updated this comment with a better description.

I'm going to bed, feel free to respond with any feedback! Thanks for looking :)


Wow! I just did this few months back.

I started collecting my writings, all in Markdown and some HTML. Just a bunch of folders as topics, and then write markdown files inside them.

Then, a week or so ago, I threw in Jekyll and now they are published as the cheapest form of Digital Garden for me and hopefully, my family - https://oinam.fyi

The crappy code is at https://github.com/oinam/oinam.fyi and is not even worth being a template.


Regarding (c), have a look at this jekyll theme [1] for photo galleries.

Jekyll is really nice to use, but the photo galleries are pretty few and far between.

Disclaimer, I couldn't get this to deploy using Github pages (which is nice) because it uses unsupported plugins. I have it split across two branches and works nicely enough. Certainly the most responsive gallery I've found.

Edit: removed direct link to the person's pictures :)

[1] https://github.com/dansku/photoGallery


Since you mentioned Rust and since this is turning into a "suggest a static site generator" thread, I'll mention Zola: https://github.com/getzola/zola , although I can't say how well it works for photo galleries.


Try Jekyll.

In addition to the above it generates static pages rather than looking into the database and templates all the time.


Yeah, or other options like https://gohugo.io/. I prefer that tool for static web content like a blog.


> Is also good at "photo journals" or galleries.

I have also been looking for something like this for a while and I can't find it.

All the static HTML gallery generators seem to be focused on dumping all images into them at single time. They don't have RSS feeds, or a convenient option to add entries one at a time as you go along like you would in a blog.

On the other hand, blog generators generally aren't optimized for mostly displaying images (e.g. automatic resizing, thumbnail view, etc.)


For the photo journal, I can recommend you this Jekyll theme https://github.com/maxvoltar/photo-stream


> What's the best static site generator that meets the following requirements: a) Doesn't use node.js.

So even if a node.js solution would be the best solution, you would still not want to use it? Why?

Anyway, I'd recommend to write a static site generator yourself. It isn't very difficult, you get exactly what you need, and you never get stuck because someone abandoned their project or doesn't want to fix the bugs you reported.


Not OP, but asking for a static site generator implies simplicity. Node is pretty famous for generally having large dependency trees and churn with tooling.

It doesn't seem that strange to want to avoid it for such a project.


Not the author. But my main concern would be maintainability issues from package churn. But also that I don't enjoy working with JS and its tooling. It is so common a choice now so it might be worth calling out explicitly.


I have had a great experience with statik.

It's in Python (pip install...), it uses a very complete and flexible Markdown library (never found a language that it didn't support, but syntax highlighting is in a plugin), and is a site generator, not a blog generator.

But it takes some up-front programming to define your site structure.


I personally like Hugo, but there are lots of static site generators. https://staticgen.com has a good overview over the most popular ones.


Any particular reason for "Doesn't use node.js", given that a static site generator isn't going to use the runtime once the site is (re)generated so you don't have any efficiency or stability concerns from your reader's PoV?

(I'm considering node for a personal project or two, though as much as possible avoiding the mess that NPM seems to be as the projects are small enough I can manage the few dependencies manually, so insight into pitfalls I'm not aware of could be useful)



Some time ago I asked myself the same question. Ideally I wanted not so much a generator but rather something that is completely self-contained. Essentially add a markdown or html file, commit and move on. Surprisingly enough I couldn't find anything that does that so I ended up building one myself. Doesn't support syntax highlighting at the moment but I've considered looking into it. Perhaps I should open source it and see if someone wants to give a hand, who knows...


Pelican [1] works this way, and I love it for my blog/website.

I write a post in markdown, commit and run a pelican-provided script that uploads the generated site to the hosting server. The script-running could be done with a hook.

[1] https://blog.getpelican.com/


Um... No, it doesn't.

> I write a post in markdown, commit and run a pelican-provided script that uploads the generated site to the hosting server. The script-running could be done with a hook.

This is exactly what I don't want to deal with. Sure, I could use a ci service but this is a typical case of over-engineering a simple problem.


I use Pelican with hosting on Netlify.

On my end I write a new markdown post and push it to Github.

At that point Netlify takes over to rebuild and redeploy my site including the new post. It's pretty trivial to do.

https://github.com/jacquescorbytuech/Blog

https://www.jacquescorbytuech.com/


Trivial? Totally. Self-contained? Absolutely no.

Say Microsoft decides to kill github pages. OK, fine, next.

Now picture Netlify changing some policy, adding some pricing or killing off a service which you need(unlikely but not entirely impossible). You have to setup the whole thing all over again with someone else, be it circleci, jenkins, gitlab, etc. Though in different contexts, I've been in similar situations and by the third time I usually want to murder someone.


You're overestimating Netlify's build tooling. It literally just spins up a virtual machine with Node on it, clones your repo, and does an `npm install && npm build`. When that finishes it copies the output directory to a server to host. Moving to a different host is a case of finding something that will let you do the `npm install && npm build` bit, which practically every modern hosting company does these days. Netlify's automated builds aren't even close to the complexity of running a CI process.

If you wanted to you could run the build process locally and commit the output HTML and CSS files to the repo, and the build process wouldn't even be necessary. You'd just need to copy the output files to a server using a git commit hook.


Which brings us back to my original question: Why????? Why bother doing all that and relying on third party tooling, regardless of how simple it is to run a command? If this is what I wanted, I could write a 5 line shell script on a raspberry pi which can do just that.

I DON'T want to do either of that. Add a file, push it and know everything has worked.


The reason I have things set up to deploy from github to Netlify is mainly because I'm not the only contributor to things I work on. As soon as you work in a team it's far simpler to have a central service that people push to doing the builds, especially if you don't want contributors to have access to the host server.


I'm not questioning the scenario where you have multiple contributors. This is one of the major reasons why the concept of ci/cd exists.

The topic of the thread is __specifically__ personal blogs/pages and my point is as strong as ever: having to deal with builds, cis, for your personal page is pure bs.


> I DON'T want to do either of that. Add a file, push it and know everything has worked.

That's precisely what Netlify offers you.


Netlify simply adds an abstraction layer over a task which I don't want to be performed __AT_ALL__. I don't care if I'm doing it myself or someone else is on a server somewhere on my behalf. It is utterly stupid to have all that to serve a static file.


So ... just serve your markdown repo using Caddy.

https://caddyserver.com/docs/markdown

”Caddy is both a flexible, efficient static file server and a powerful, scalable reverse proxy. Use it to serve your static site with compression, template evaluation, Markdown rendering, and more.”

https://caddyserver.com/

Here’s a blog on doing this with the older version of Caddy:

https://blog.thomaspuppe.de/static-sites-from-markdown-with-...


So write HTML and push that directly to your webserver.. what do you want from the world haha

Forgive me for suggesting the first thing that popped into mind, could you run the generator script locally and also push the /public dir which your server then serves directly?


> So write HTML and push that directly to your webserver.

A much better option. Still have to deal with the de-facto boilerplate of every html file: head, body, header, footer. Which is why I built something that does it in the browser for me.

> Forgive me for suggesting the first thing that popped into mind, could you run the generator script locally and also push the /public dir which your server then serves directly?

Same as CI - adds an extra step to the process. But as I said, services like Netlify come and go and the news might slip by you and catch you off guard. If I had to go down that road, I have ~10 raspberry pi's 6 of which are currently booted up. A 5 line shell script could easily do that. But again - I see no point in doing it if there's no need for it.


> A much better option. Still have to deal with the de-facto boilerplate of every html file: head, body, header, footer. Which is why I built something that does it in the browser for me.

I find it fascinating that you'd go to all the trouble to build what essentially breaks down to a custom static site generator but you then balk at using an off the shelf one with a build script.


The difference is that ci-type of solutions might end up requiring maintenance for a million and one reasons. This won't and building it took me roughly the same amount of time it would take me to navigate through a ci-solution and test that I've set it up correctly(3 hours in total).


Something must turn the .md into HTML, and something must also publish it. You end up with 2 choices: the above one, or sth like GitLab pages, where you need to provide a CI script but then can just commit & push.


Yep, you're right, something must turn the markdown into an html. In my case, I let the browser do that and by doing so, I avoid the hassle around builds, cis which is what I didn't want to deal with. For something so brutally simple anyway.


Posted this deeper in thread, also noting up here:

Just serve your markdown git repo using Caddy.

https://caddyserver.com/docs/markdown

”Caddy is both a flexible, efficient static file server and a powerful, scalable reverse proxy. Use it to serve your static site with compression, template evaluation, Markdown rendering, and more.”

https://caddyserver.com/

Here’s a blog on doing this with the older version of Caddy:

https://blog.thomaspuppe.de/static-sites-from-markdown-with-...

You get a lot of other “just works” goodness too.


FYI our v1 site went away this week (we've had redirects for about 7 months now). Here's the link to the v2 docs for markdown rendering with templates: https://caddyserver.com/docs/modules/http.handlers.templates...


Redirects may have been wrong form? This was top link in Google and DDG for ‘caddy markdown’... but to your point, it didn’t respond. So I figured right page based off of the snippet and visited status. Right form of redirect should update the index, no longer show the old page.


https://github.com/kittykatattack/thepoetrybook

Did something like that years and years ago as a learning project. Works great! Drop in some markdown and you’re done. The source is only a few hundred lines; no build or package manager.


So you're talking about a static site generator implemented in javascript in the browser? I don't see why it wouldn't work as long as the webserver supported directory listings, but it would obviously completely break for clients not using javascript.

The simplest solution I've used is to just have a Makefile that indexes and stitches together pages using cat/sed/ls. Sure, you have to run make (and possibly make upload if you're not doing it live), but it's not so bad.


Essentially yes, this is what my personal site is currently running(though it is empty as it stands, largely due to time constraints). Except I wrote it in Dart because I abhor javascript with a passion, even if the final output is still javascript.


Yeah, I also am guilty of liking to write static site generators more than liking to actually write something!


> Ideally I wanted not so much a generator but rather something that is completely self-contained. Essentially add a markdown or html file, commit and move on.

Could you explain what you mean here?


As I said, make it fully self-contained without relying on "builds" or any other mumbo-jumbo, the way you would with sphinx or hugo or whatever. Essentially add a new html or markdown file, put whatever you want in it, let's call it "something.md". Then add a link from your index page to "#/something.md" and not deal with builds or styling or whatever, simply commit and move on and have it take care of all the html. And in the case of markdown, parse it and render it as html on the client.


Does Algernon fit the bill? https://github.com/xyproto/algernon

Quoting their README:

Web server with built-in support for QUIC, HTTP/2, Lua, Markdown, Pongo2, HyperApp, Amber, Sass(SCSS), GCSS, JSX, BoltDB (built-in, stores the database in a file, like SQLite), Redis, PostgreSQL, MariaDB/MySQL, rate limiting, graceful shutdown, plugins, users and permissions.

All in one small self-contained executable.


I searched for something similar. Considered Caddy and Nginx/Apache with markdown plugins, but wanted to be able to create and edit pages/files and made a small script with Flask instead.


Not a static site generator (if that's what you mean), but I personally went with Grav: https://getgrav.org/. It's a small CMS written in modern PHP where the content is defined and managed via markdown files (so no need for a database). You have a bunch of themes and plugins directly installable through the admin interface and the documentation is good.


I've been thinking about putting something out there as well. I'll probably end up using Pelican since I'm a Python fan.

As a side note, I can't believe how many people are salty that you don't want to use node. It would be funny if it weren't so sad.


a) seems like a very arbitrary restriction


It doesn't seem like an arbitrary restriction to me though. The node.js ecosystem is a complete disaster if you're not tuned in to it, and if I want a fire and forget blog generated from static files then that's the complete opposite of node.js where you have to unfuck the imbred dependencies that form in the bloated, always changing ecosystem when someone decides to go CADT with their components.


Some people just don’t like that ecosystem, and that’s OK I guess.


I'm one of them, the most frustrating thing with working with modern JavaScript is definitely the ecosystem rather than the language. React Native is particularly an issue, the recommended react-native-community geolocation library just flat-out fails on many Android vendor's phones, and the replacement someone made for it still isn't exactly reliable (although to be fair, it only broke on OnePlus devices which were later patched so it could well have been an phone-level issue).

I get it, I shouldn't complain about the quality of open-source and freely offered software and the onus is on me to audit the libraries I put in my code, but blimey some people take an awful lot of liberty with the truth when they claim something is "production ready". I reckon a lot of people just build some rushed, poorly-written JavaScript libraries so they can pad out their CVs as an "open-source contributor" but the only thing they're actually contributing is a massive headache for muppets like me who foolishly use said code in their own projects.


From my point of view it is a very informed decision.


I use Jekyll. It’s simple, easy to use and well supported. Also has lots of free and paid themes available.


Check out Jigsaw, it's a PHP based static site generator


I have set non-technical people up using Markdown+pelican. I have no idea what made us use Pelican instead of something else, nor if those advantages still hold weight, but it’s been great.


For what it's worth, I prefer Pelican, largely because I can write a plugin if I need, without incurring significant brain damage.

I've written code in PHP, Ruby, and JavaScript before, it's just not my first choice.


Who do you want to avoid node.js?

It's dependencies are too big?

It cannot be hosted by cheap webhost?

It's not secure ?


All of those.


Cobalt, Jekyll, Hugo




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: