Hacker News new | ask | show | jobs
by jeffreyrogers 1600 days ago
My ideal static site generator would have a locally run web app for editing files, styling content, etc. and then would just generate the static assets when you're ready to deploy. Not sure if anything like this exists currently or not.

Static sites are nice from a deployment perspective, but CMS's make a lot of things easier than static site generators do. Seems like there's room to have the best of both worlds.

21 comments

Static sites are nice from a deployment perspective, but CMS's make a lot of things easier than static site generators do. Seems like there's room to have the best of both worlds

thank you, that was my experience too.

as a web developer, my primary concern is the users who provide content for a site (including myself).

i have only actively worked with hugo myself and i was disappointed by its complexity.

there are only a few situations where a static site generator is helpful.

one is a distributed team of teach-savy volunteers. here it means that i can submit occasional changes to a site as a patch.

however, the group of people that will benefit from this is limited. and the benefit does not come from the fact that the site is made with an SSG but that the content is stored in a text based revision control system. the friction in such a situation is access control and not deployment. one could easily imagine a dynamic site that pulls its contents from a text based source and still get the same benefits.

I created https://sitepress.cc/ because you can have both! It can run a dynamic content site from a Rails app or it can compile out pages that can be deployed to any static website host.

It doesn’t have a front end for authoring pages, styles, etc, but that could be built on top of this library.

Lektor might be worth a look: https://www.getlektor.com/

After creating a site you start a local server by executing "lektor run" in the local folder, then preview the site in your webbrowser. There you get a edit-button whivh opens a backend with which you can edit the website. From that backend you can hit an upload button which allows you to push the static site directly to a remote (e.g. via scp).

Multilanguage support works quite good as well.

Yeah, there exist a few like that for WordPress, I know a few big sites use them. I think Simply Static <https://wordpress.org/plugins/simply-static/> is pretty popular?
A friend of mine used a WordPress plugin that did exactly that. He'd style and develop his WordPress website locally, then generate a static "snapshot" and deploy it. Of course it came with all the usual WP bloat and complications, but for my friend that's a feature, not a bug.
I believe the most popular implementation of this is Leon Stafford's WP2Static (open source). I've heard good things about it for years, but have never personally tried it.
You can do something a little like this with Nuxt and Nuxt Content:

https://content.nuxtjs.org/

On the surface it seems like a pretty roundabout way to work, but the static generation side of things works well. Not quickly (well, not Hugo-quickly).

Yes such things do exist. You can even have a traditional CMS like WordPress or Drupal, where content writers put content and have the build step of the static site generator pull the content down and include it.
Drupal has Tome, which some people seem to love: https://www.drupal.org/project/tome
Nobody should ever use Drupal in 2022 - it is horrible.

They tried to convert the base to the mainstream PHP framework called Symphony - but there is still too much "PHP Think" in the code, lessons of modern web development never learned, abyss of bad practices.

Also Symphony is more of a joke copy of frameworks from other languages, e.g. often security problems in auth code after many years of development, like the coders simply do not understand what they are doing - you should not rely on that as a base. People speaking of Symphony as a "quality framework" have not worked in different IT areas or with different languages most often - it is mainly a small group of french developers that depend on the popularity of Symphony and keep up a cult, but it is still a joke.

If you are a customer and somebody is offering you a product based on Drupal, save yourself some horror.

Good people simply have left the PHP world a long time ago and moved on to different languages and frameworks. What you get today as "PHP Developers" is the underdogs, the people, that can not get good jobs with better quality work experience missing, mostly people from the global south or eastern europe that have been misused for many years by companies that wanted to save a lot of money on "cheap coders" to sell bad products.

Wordpress is still no shining example of good PHP, but somehow the company Wordpress managed to establish a not too bad ecosystem, still miles ahead of what Drupal is - so if you are forced into PHP, Wordpress with near to zero plugins plus the great static export plugin will give you best results.

That concept reminds me if Joel Splosky's CityDesk[1] software which ran locally (desktop rather than web) and had a publish button to upload the results.

I quite liked it but development tailed off after a couple of years so I imagine it failed in the marketplace.

[1] https://www.joelonsoftware.com/2001/10/12/what-does-citydesk...

I think Publii[0] is the modern equivalent as it also runs on desktop and provides a blog-ish CMS with its own editor. I used it to make a small devlog[1] some time ago (on which i only wrote a single article, proving once and for all that the reason i do not blog more isn't because of the blog tech but because i'm too lazy to and i'd rather be writing endless posts in messageboards :-P). I do prefer the CityDesk style though[2], even if Publii is technically more powerful.

[0] https://getpublii.com/

[1] http://runtimeterror.com/devlog/

[2] http://runtimeterror.com/pages/badsector/nyan/gimme/cdsite/

I used Publii for my blog, but it was very constraining in terms of its styling (the templates were mediocre). And I had made changes to its defaults for styling (which ended up not being responsive), so that when upgrades came around, it messed things up enough that I just stayed on prior versions. Now I'm stuck.

The whole template problem, along with customization (or is it configuration?) is the biggest blocker for me. I'm going back to a straightforward Markdown-like to HTML generator for my next blog revision.

Yeah, i wanted to make a simpler template like the one used in CityDesk or the one in the root site (that i haven't updated for ages however i already had made a custom template for consistency: the "Blog" part was generated by Pelican and the rest of the site with a custom generator) instead of the heavy one i ended up using (that IMO is the best -or least bad- among those available, at least according to my taste and needs :-P). But when i tried to figure out how to make a custom theme i just noped away.
As I mentioned in another comment somewhere else in the thread, there are a few apps (Lektor, Kit55, Pinegrow) that do exactly that.
There's also Cloudcannon! https://cloudcannon.com/jekyll-cms/
Many CMS's have limitations in what they allow you to style. The needs kind of clash, the system wants simple templates that every page should follow but writers may want to be able to put some extra styling here and there. For full freedom you basically end up with a programming language. Otherwise the more advanced things gets really hard to do (iterate over each news-blurb and show it but paginate it to only 5 items per page). Just allowing the user to add a few images to a page and have them show up nicely is pretty hard if you don't control the layout hard.
> Static sites are nice from a deployment perspective, but CMS's make a lot of things easier than static site generators do. Seems like there's room to have the best of both worlds.

A few years ago I wrote a static generator for Ghost. The workflow was the following:

- A Ghost instance runs on my raspberry pi

- I log into it to write content, and save

- A hook is triggered by the content update (this is a native Ghost feature), that sends an HTTP request to a local ExpressJS instance

- A script downloads the whole dynamic Ghost site as static files, fixes the links, and then publish them somewhere

It was _very_ brittle but it worked for my use case.

Wasn’t it movable type that had a dynamic admin area and then produced static assets every time a user saved a blog post.

Everything was generated on the server but only static pages was served to visitors.

You can use tools like staticgen [1] with any CMS that you want.

[1] https://github.com/tj/staticgen

That looks like Publii. A no-frills SSG with a UI quite similar to WordPress that works completely off-line and generates static files to deploy anywhere.
Every static site generator can be used like that. You can run them all locally to build a directory of static HTML files that you can rysnc (or FTP, or git, or whatever) to a server.

How you generate the content is a separate question. It's quite common to use WordPress as a CMS (because the content people already know it), and then pull the content in to something like 11ty or Gatsby to bake to files and put on a server.

@jeffreyrogers I was about to suggest Lektor, but @atoav beat me to it. :-)

I currently use pelican since i'm ok drafting my stuff in markdown...but I used to use lektor alot...and every person - techie or non - that i've shown Lektor (back when i used it myself) loved lektor! Since that time i'm sure there are other SSGs that operate like lektor.

The best of both worlds already exist: take a CMS (like Wordpress) and generate static content from that. There are multiple Wordpress plugins that do that.

You have one Wordpress instance completely internal, safely hidden behind a VPN, get all the convenience of Wordpress, and each time you publish a change in an article it will publish the static site.

Yes, that's a nice solution. It's very easy to create a local instance of WP with the Local.app (localwp.com) and use the WP2Static plugin to generate a static version of it (or appi.sh, if you need to do that via terminal).
Astro is working on something that lets you edit and preview markdown files locally via a web based WYSIWYG editor.
Many static site generators are so fast that you could use, say, the unix `watch` command to rebuild your website every two seconds while running an `http-server` locally to preview the results. And then just rsync the artifacts when ready to deploy.
I've been using Nikola which can publish Jupyter notebooks - which turns out to provide most of the functionality I actually want (previews, graphs, drag and drop image inclusion).