7 ms·
Writing HTML by hand is easier than debugging your static site generator
- deleted 2y ago[deleted]
- mikae1 2y ago> I am on the threshold of believing “actually just writing HTML by hand is probably easier” Might be true until you need to create those lovely RSS feeds by hand… > Do you enjoy debugging programming language installations? What about the language’s package ecosystem? No and that is why I switched from Jekyll to the single binary SSG Hugo. Zola works the same way, single binary.
- superkuh 2y agoThat's actually pretty easy too. Take a look at an RSS file. There's a reason it's called really simple syndication. Adding another entry to an RSS file with your text editor is dead simple.
- mikae1 2y agoAdded friction means less writing, in my experience. But that depends in his often you update your site, I guess. I'm bound to believe that more friction means less updates.
- superkuh 2y agoI suppose if I were posting 5 times a day rather than 5 times a month doing the below would get tedious, <item> <title>It's not that hard</title> <link>http://www.superkuh.com/this-link-doesnt-exist</link> <description>This is an example of how quickly I can add a new item to my RSS feed.</description> </item>
- throwanem 2y agoOr if you wanted to syndicate via RSS rather than just linking, which frankly reads more like an SEO move than one intended for the benefit of human eyeballs...
- boxed 2y agoFor me the issue is that Jekyll is pretty terrible, and I guess something is iffy with ruby somehow? I don't really know or want to find out, I just want to publish my little blog.
- mikae1 2y agoI think I was never able to keep Jekyll working for more than six months before it broke down beyond repair. Today there's also gojekyll (which is a single binary). https://github.com/osteele/gojekyll https://github.com/osteele/gojekyll
- boxed 2y agoYea, me too. If I follow the advice of GitHubs dependabot screaming about exploits in the markdown renderer, then it breaks 100%. I just had to silence it.
- bachmeier 2y ago> Might be true until you need to create those lovely RSS feeds by hand… There are other options. I know for example that there was an extension for Pandoc that did it for you. Edit: https://github.com/chambln/pandoc-rss https://github.com/chambln/pandoc-rss
- fwip 2y agoWhich is SSG again, albeit with a more limited scope.
- skgough 2y agoFor simple static sites with repetitive sections I don't want to write by hand, I find that building a simple generator in Ruby with ERB templates that loop over the rows in a SQLite table is the simplest way to do this. There's no dependencies to pull in, the ERB templates are already pretty close to HTML already, and there are plenty of GUI tools for SQLite files that make it easy to add rows by hand.
- freedomben 2y agoThis is extremely underrated! ERB is a phenomenal tool for static site generation. Great templating language, excellent CLI tools, easy to wrap a script around. I honestly wish I'd done it sooner.
- greenyies 2y agoI'm using site generator for site generator use cases... And servers which do not have any backend. Even apache2 SSI isn't enabled by default. A standard default templating system on static content hosters would help.
- numlocked 2y agoI almost agree. The thing that keeps me coming back to static site generators is HTML partials. Having a header.html file that defines my navigation, that I can edit once and include everywhere, is why I pay the complexity tax. And since I'm already there, I do also like scss + file watching / hot reloading. Though would happily live without it, if there was a 'native' solution to e.g. <html> <% include './header.html'> <body> ... </body> <% include './footer.html'> </html>
- superkuh 2y agoUse a webserver with server side includes (SSI) like nginx or apache and you can <!--# include file="/header.html" --> in the other HTML files themselves and it's all completely transparent. No need to 'build' or anything. And no complex software stack to mantain or worries about attack surfaces like with dynamic languages like php. Just the bare minimum power to do templating that hasn't changed or had issues in 20 years.
- numlocked 2y agoWell, except for the webserver with nginx or apache, correctly configured with SSIs enabled. It's not terrible -- but not 'obviously' less complex than using e.g. 11ty (a static site generator) + uploading to an s3 bucket or FTP server. Just trading off complexity in one place for complexity in another. A sibling (top-level) comment suggest a standard HTML templating (or SSI) language that many static hosts would support. I like that idea quite a bit conceptually, though of course much easier said than done.
- danvoell 2y agoI pay the nav tax too but use “static” php.
- josefresco 2y agoI did (still do) this for years but it just feels... wrong. I recently hand built a personal site and used JavaScript to insert the html header/footer. Not great, but it worked.
- smokeydoe 2y agoOnly if you use nextjs…
- imagetic 2y agoI've never met a Wordpress person who cared.
- facorreia 2y agoAnother option is having the site generator packaged as a docker image and executed via a CI pipeline when the static files are pushed to a git server. Relying on stuff installed on a local laptop for the publishing pipeline isn't sustainable.
- coldcode 2y agoReally, my art site has 1600 detail pages, and I wrote my own site generator (in Swift) for it. You think I would want to write all of them by hand? Sure, I could have a dynamic site (ROR, or Express or whatever) but static is easier to serve, and changes are quickly diffed except once a month when the structure is updated. If was just doing a small site, sure, but anything substantial requires something better.
- gnarbarian 2y agoI have to agree. we have way too many layers of abstraction in front end development these days. you may be able to generate a static site quickly but good luck coming back to it after 10 years. how many of the dependencies will still be maintained? will it still even build? back in the day tools like jQuery were a godsend for ironing out the browser incompatibility but now standards are much better. well supported tools like that were a great abstraction point to help simplify the codebase and provide consistent functionality in an ever changing landscape of web standards and browser compatibility. today we have the opposite problem. we have a incomprehensible mess of middleware designed to help out in some way or another but when you add it all together you end up with a 10MB hello world with 3,000 npm dependencies. recently I decided to write a PWA using only hand rolled HTML and JavaScript and it was a pleasure. the only dependency I had to add was Nosleep.js for safari. it was extremely satisfying compared to dealing with a more modern toolchain.
- tasuki 2y agoI've had some Jekyll and Middleman sites around for ten or more years and it's fine. Now and then something breaks and needs fixing. The Ruby 2 to 3 transition involved breakage, but nothing too bad. Certainly beats having to change the header or the footer in a thousand pages, or headers getting out of sync!
- lelanthran 2y ago> you may be able to generate a static site quickly but good luck coming back to it after 10 years. If you're using Jekyll or Hugo or similar, sure. My SSG is a tiny shell script that calls pandoc. I have no problem coming back to it to fix it, but because it's so small there's literally nothing to fix. I can make it even easier if I used Makefiles.
- lemonberry 2y agoOn the other hand, if your SSG does break you still have the HTML files that can be edited by hand.
- bachmeier 2y agoStatic site generators vary greatly in complexity. I typically use a Makefile or Bash script that calls Pandoc for all the markdown pages. Also, writing html by hand is not really necessary in any circumstance. You can write the markdown directly in the html files, use a CDN for markdown conversion, and you're done. The author is referring to a particular generator, which I agree can be a ridiculous process.
- zeroCalories 2y agoStatic site generators are so simple and powerful it blows my mind that anyone would suggest plain html is a suitable replacement unless your site is like 5 pages. They're so simple to build too, so if you're miffed about bloat you could throw together a simple md -> html system in a few hours, if not minutes.
- deleted 2y ago[deleted]
- bigstrat2003 2y agoPlain HTML is pretty simple and powerful too. I don't really have a dog in the fight because I don't have a website, but I don't think it's unreasonable that some might find it easier to just write HTML by hand.
- edflsafoiewq 2y agoIMO the main point of an SSG isn't that you can write in Markdown, it's stuff like templates and includes for headers/footers, automatic generation of RSS, site directories, tag clouds, etc. You still need that stuff whether you write HTML or MD.
- simonw 2y ago> This becomes obvious when you eg get a new work machine and need to set up the site generator on the new machine and realize that the exact series of bits you had on disk on the old machine were different than what you can achieve on the new machine. And as a result the site generator doesn’t work even though the setup is “the same” That's why I never use ANY tools like this without getting them working in something like GitHub Actions (which is effectively free these days, and all the good LLMs know how to write YAML workflow files for it.) If you outsource the running of these tools to a CI service you don't have to worry about setting them up on new machines.
- Aldipower 2y agoHehe, until you need them to set up at a new hosting provider in the future. Maybe Blubsput.com?
- simonw 2y agoI've pretty much committed to GitHub Actions at this point, under the hood it's just running shell scripts on a Linux machine so it's a pretty solid base for deploying to whatever hosting I might use in the future. For static stuff I can use GitHub Pages directly. Notes here: https://til.simonwillison.net/github-actions/vite-github-pages https://til.simonwillison.net/github-actions/vite-github-pag...
- chrisjj 2y ago> I never use ANY tools like this without getting them working in something like GitHub Actions GH says: "The software tools included in GitHub-hosted runners are updated weekly." so don't you have the same problem?
- simonw 2y agoNo. I can pin the Python version and if I really need to I can use a Docker container to ensure exact versions of something I'm using.
- 2y ago
- KingOfCoders 2y agoNot a joke, ChatGPT does 90% of my Hugo code.
- darkotic 2y agoI want something that just publishes my markdown files in my Obsidian vault as a static site.
- jasonlotito 2y agohttps://obsidian.md/publish https://obsidian.md/publish
- kepano 2y agoThere are dozens of options for this: Jekyll, Hugo, Quartz, Astro, Eleventy, etc.
- tasuki 2y agoHow do you maintain the common parts then? I don't know about your static generators, but my 40 lines of bash are very easy to debug!
- grishka 2y agoI'm surprised no one mentioned Dreamweaver here. It's technically a "static site generator" as well but without any of the problems that the author is talking about. You make templates, you make pages that substitute things into the templates, you generate a bunch of html pages, done. All with a nice GUI, live preview and optional wysiwyg.
- wodenokoto 2y agoI bit my html teeth on dreamweaver back when it was a macromedia piece of software. I thought today it was abandonware. My problem back then was it was hard to understand what features were server side and required a special host (e.g., your all important visitor counter) what was generated by dreamweaver and what was handled client side.
- dewey 2y agoAfter many years of using Hugo as a static site generator and moving my blog from blogging software to blogging software over the years I realized: - It's fun to play around with static site generators as a technical person - It's very annoying to actually write content (As you link images by using the file name, no nice editing interface, using a markdown editor is clunky as features of the blogging software (Embedded videos tags etc.) are not supported - It's impossible for non-technical people to use it. My main reason why I would never introduce a static site generator for documentation at work again. - You still need some kind of tooling to generate RSS feeds, sitemaps, pagination, so I've settled on https://getkirby.com https://getkirby.com for now which has a nice editor interface but is file based and doesn't need a database. Makes it easy to backup and move between hosts if needed.
- exe34 2y agoI've got my org-mode set up to dump out all my org files into html files, which get syncthinged into my phone.
- add-sub-mul-div 2y agoFor a static site I'll use Django and its admin site as a CMS because that's what I know inside out, then I'll use wget in its spider mode to get a static version of the whole site. Has worked great for simple enough sites.
- dclowd9901 2y agoI’ve been seeing a lot of these kinds of posts and sentiments lately. Yes, it _is_ easier to write plain ol HTML. But how do you handle consistency by hand writing each page? How do you scale your site or add * number of posts or headers and footers that do things like show the latest post? If you update a link somewhere, how do you ensure all the links pointing to it are valid? We don’t do these things because we’re masochistic. We do them because they, on the net, make things easier. I suspect this sentiment is some kind of new version of the Eternal September, where people previously unexposed to the hardships of creating functional websites think we somehow missed something in our slow march toward where we are now. I happen to have a hand built static site. It had two pages. When I built the second page, I took the first html file, copy pasted it into a new path and made the changes. That works splendidly for a two page site. But most sites are not this way, I imagine.
- _xivi 2y ago> How do you scale your site or add * number of posts or headers and footers that do things like show the latest post? It depends on your needs, some use a templating language (like Handlebars, Nunjucks, Pug, etc), others might write a script to build the site The problem with many static site generators is that they grow beyond their initial mission and get bloated in an effort to please a wider audience, so previous adopters get tired of the imposed complexity and problematic dependencies they didn't need or ask for and start looking for simpler solutions that meet their needs. I want to migrate, but my blog currently has this cool thing and I need it. And since the audience probably can't settle, and keep trying different setups, all SSGs grow in complexity and more or less reach feature parity among each other.
- adriangrigore 2y agoI only created https://mkws.sh/ https://mkws.sh/ for duplication and templates. Those are the only problems it solves. I think it's portable enough.
- _heimdall 2y agoI'm happy to hand author a small site, but the line for me has been around 3 or 4 pages before I reach for one templating engine or another. For something like a marketing site, the homepage is usually custom enough that you wouldn't repeat yourself much. Throw in an about us or contact page and you'll be fine. Much past that and I want partials for basics like the header and footer, and likely a few layout components. Debugging a static site generator should be a thing in my opinion. When you gave to debug an SSG it's because the tool has to much magic built into it like automatic data pipelines, opinionated front-matter schemas, etc.
- manlobster 2y agoGenerating the HTML in a container seems like a better solution than ditching the generator altogether.
- modernerd 2y ago> "Do you enjoy debugging programming language installations? What about the language’s package ecosystem? What about the language’s deployment model (or lack thereof)?" Switching to a generator that ships as a single binary largely resolved this for me. With https://www.getzola.org https://www.getzola.org and similar you only need worry about installing the same version as the one that's building your site in production.
- Waterluvian 2y agoI’ve tried so many and the thing that just philosophically drives me nuts is when I want to purge it of the 80% of features I don’t want.
- deleted 2y ago[deleted]
- jppope 2y agoStatic site generators are very simple... so not really understanding what they are getting at. And for all the people who seem to struggle with writing markdown files or using a static site generator check out pagescms: https://pagescms.org/ https://pagescms.org/
- weberc2 2y agoYeah, they're actually simple enough that they're kind of a perfect way to learn a new language... You get to try something that is pretty familiar (transforming some source files into some destination files), small enough that you can actually build the thing in a weekend, and big enough that it isn't just a toy program--it will give you a tour through the standard library, the build tooling, the package management / ecosystem, etc. You can also use it to play around with different programming paradigms--I recently rewrote mine from Rust to Go and played around with a maximally parallel architecture (what I thought would be a fun throw-away experiment quickly became my production SSG): https://blog.weberc2.com/posts/efficient-ssg-with-csp.html https://blog.weberc2.com/posts/efficient-ssg-with-csp.html
- et1337 2y agoIf we’re talking Jekyll, I completely agree with this post. But Hugo is a single binary that runs on practically anything. And it does stuff that would be a huge pain otherwise, like generating responsive image sets.
- notatoad 2y agothis is one of those things that's true for the trivial case, and then quickly falls apart as soon as you add even the slightest amount of complication. writing html by hand is easier if you post infrequently, you only post basic text content and you're the only contributor. if you're posting daily, or you're sharing photo galleries, or you're trying to manage contributions from multiple authors, or you have any styling more than the absolute most basic stylesheet, then you're going to last about a day before you start trying to automate things again.
- iveqy 2y agoThe beauty with a static site is that if you have a copy of the generated output, using the site generator becomes optional. You can always move away from using it (but not moving back). This means that a "custom buggy sitegenerator" is never a bad dependency to have.
- frugalmail 2y agoBesides using a single binary static site generator that other people have mentioned, docker would solve this problem for you.
- agentultra 2y agoI mean... I used to do that back in 1997. Before I wrote a perl script that would generate my site from a bunch of text files. My script would also ftp the files but that was replaced by rcp. The benefit was making sure the links all worked and common page elements like the site navigation, header, and footer were all consistent. Many folks in that era would use an IDE like HomeSite, FrontPage, and DreamWeaver... these would have template features that you would generate your site from. These tools were very much like using my script only slow and expensive. I do get where the author is coming from though. There are some static site generators that pack more features and require more configuration than a space command centre. I don't get the appeal of those. The key is to keep it as simple as possible.
- dheera 2y agoSimilarly, I find jQuery refreshingly easy and simple compared to React.
- deleted 2y ago[deleted]
- shepherdjerred 2y agoAstro [0] a relatively new static site generator. It solves all of the issues I've had with SSG's that feel heavy, like Gatsby. Astro is only as complex as you make it. It lets you write JSX-like syntax that compiles to static HTML. I use it for my personal site. [0]: https://astro.build/ https://astro.build/ [1]: https://sjer.red/ https://sjer.red/ [1]: (source code) https://github.com/shepherdjerred/sjer.red https://github.com/shepherdjerred/sjer.red
- curtisblaine 2y agoSo this good advice until you need templates, which you need if you want for example syntax highlighting (include the css and the js file which parses code). From there, it's all a nightmare of having to re-sync every template change and it becomes not worth it.
- Ancapistani 2y agoGenerally speaking, all I really want from an SSG is to be able to keep my pages in a format that's more readable than raw HTML. A few years ago, that was reStructured Text. Since then, it's been Markdown. Shortly after CommonMark came out I converted all of my ReST docs to it, and haven't looked back. Theming, shared blocks, etc. are all handled just fine by using includes. If those are stored in Jinja2 templates or HTML files that use SSIs is pretty irrelevant to me. As long as I can write in Markdown, I'm happy.
- freedomben 2y agoIf you're an Elixir person, the last year or two has had some interesting developments. For example Vox[1]. There's also a nice roll-your-own SSG using Phoenix[2]. I don't know why Elixir-based SSGs seem to die out quickly, but hopefully something will stick! [1]: https://github.com/geolessel/vox https://github.com/geolessel/vox [2]: https://fly.io/phoenix-files/crafting-your-own-static-site-generator-using-phoenix/ https://fly.io/phoenix-files/crafting-your-own-static-site-g... - HN: https://news.ycombinator.com/item?id=40850021 https://news.ycombinator.com/item?id=40850021
- bogwog 2y agoWriting my own SSG was the best investment I ever made into my own sanity. The only drawback is that I can't really help people when they ask me for an SSG recommendation since most people won't want to do the same. I recently suggested to someone that they use Jekyll (after I did a small amount of research) but reading these comments makes me worried that was a mistake lol
- lorisdev 2y agoDevContainers have solved this problem for me. If I want to update my site from a different machine, I just need to git clone and open the folder in vscode.
- justinmayer 2y agoAs the maintainer of the Python-based Pelican static site generator for over a decade, I can say with confidence that my experience has been nothing like what is described in this article. Most of Pelican’s code was written by other people, and yet I have spent almost zero time debugging that code, much less my own. After taking advantage of Pelican’s rich plugin ecosystem and adding a handful of useful plugins, I continue to be amazed by how much time this publishing system saves me, and how little time I must spend to keep everything running smoothly. What it would take to accomplish this by writing HTML by hand instead… I simply can’t fathom it. But once again, that’s just one person’s experience, and YMMV. [0]: https://getpelican.com https://getpelican.com
- err4nt 2y agoIf there was a code editor that _actually_ supported the HTML language as it's specified, and allowed you to select by element in the editor as well - that would be amazing. Right now the problem I have is that text that's been marked up as HTML suddenly then becomes harder to wrangle around than it was to put it into HTML in the first place. I want an editor where I can "select all <p>" or "search and replace all <h2> tag names with <h1> tag names while leaving attributes intact" and other ways of reasoning about HTML as HTML in my editor.