from Hacker News

No longer writing my own damn HTML

by claytonwramsey on 2/12/25, 3:45 AM with 93 comments

  • by peteforde on 2/12/25, 7:19 AM

    I don't understand your hangup about using JavaScript to accomplish tasks that JavaScript is extremely well-suited to do. The idea that you are somehow imposing a burden on your visitors is an imaginary constraint which is actively consuming the finite minutes you have on the planet. This is a pyrrhic victory.

    I am not advocating using SPAs of any kind, especially in a blog context. However, if there is a library which makes it easy to render MathML, why the hell wouldn't you just use it?

    I'm not saying that I've never invented artificial constraints for myself; arbitrary goal posts that literally nobody but me would ever notice much less care about. I am saying that perspective is everything, and that sometimes it can be hard to see from the inside.

    This is intended as an expression of care.

  • by Brajeshwar on 2/12/25, 4:33 AM

    After many iterations of tools, systems, and processes, I have settled on writing in plain text, in Markdown, to identify headings, paragraphs, quotes, images, etc.

    My reasoning and approach is that I or someone should be able to read it as it is and then have a tool parse it to spit out HTML for browsers, helping others read it with a better experience.

    With thousands of posts, it would be complex for me to maintain them in HTML. Now, my blog is powered by Jekyll because of GitHub pages. However, I can quickly switch to any other tool with minor tweaks.

    Locally, I see my blog posts as individual files with dates `YYYY-MM-DD` and the title in their yearly folder `YYYY`. Some are in `WIP`, which I can continue to update/write. The `future` folder contains the ones that are drafts, but I can see them and don't mind if someone stumbles on them. Always a work in progress and am even aiming to simplify it further.

  • by Sabinus on 2/12/25, 6:41 AM

    I just want to say how funny it is that this is posted after the spirited discussion in the previous related thread about exactly what 'writing your own html' means.

    https://news.ycombinator.com/item?id=42996322

  • by defanor on 2/12/25, 6:25 AM

    As an option that still uses HTML, with relatively minimal and common dependencies: the unified header and navigation insertion, as well as other aspects of website generation and syntax checks, can be handled with XSLT. Or one may employ a generic macro processor like M4, which should be fairly easy to set to convert LaTeX into MathML, as well as to include shared headers.
  • by Joker_vD on 2/12/25, 9:48 AM

    > handwriting HTML is honestly not that hard.

    > To write a new article, I... [c]opy-paste an older article to get the correct headers and navbar.

    This is kind of hilarious. Any parts that you copy-paste from your previous projects into your new one are almost by definition too hard to do from scratch every time. You don't normally copy-paste e.g. single words or phrases like "do from scratch" into your writing because simply writing them is quicker and less fiddly than copy-pasting them from somewhere else, right? Yet I've worked with a dyslexic programmer once, and he copy-pasted tons of single words and phrases around from his earlier messages when chatting, and code snippets when coding — because for him, it was indeed easier than writing it correctly from scratch.

    So back to main original point: handwriting HTML may not be that hard, but it's still hard enough for almost anyone to make them evade it whenever they can.

  • by natnatenathan on 2/12/25, 4:44 AM

    I have always written my own static blog generator, moving from PERL to Ruby and most recently Python. I find the other blog systems are too complicated for what I want. Plus, I think I like writing the generator more than writing actual posts.
  • by Evidlo on 2/12/25, 6:24 AM

    A funky option for doing client-side includes and basic templating without JS is XSL.

    Here's an small demo I threw together https://github.com/evidlo/xsl-website

    A lot of people hate on XSL, but it has some interesting abilities!

  • by vunderba on 2/12/25, 4:38 AM

    I can definitely relate to building towards an easier "write -> publish" workflow. My old site is still running WordPress but I just got frustrated with the overall feeling of oppressive heaviness to the whole framework (no shade on WP, I still really like it).

    I switched over to a similar process but opted for Pelican (since I'm more familiar with Python vs Rust) which builds directly off my markdown notes in Obsidian so it's relatively WYSIWYG. Much easier to maintain and Github Actions automatically handle updates.

    https://mordenstar.com/blog/obsidian-to-pelican-exporter

  • by james-bcn on 2/12/25, 7:36 AM

    I think the key to getting into the habit of writing blog posts is to make the actual process of writing and then publishing as easy and frictionless as possible. I use Bear app for the writing - it's a very well designed markdown editor with some really nice, simple features, such as nested tagging. I then got ChatGPT to help write some scripts to publish it via the Quarto static site generator. I wrote about the process here: https://thisisjam.es/creating/quarto-website-with-bear/
  • by geor9e on 2/12/25, 5:16 AM

    What I did was store my Obsidian vault in my website server folder. Then I instructed Cursor to make all /whatever.md markdown files in there show up as HTML when you visit "/whatever" , and to get all the obsidian features like [[links]] and ![pics] and all rendering right. It used php and some apache settings. Works great. Now I just edit in Obsidian, and it all appears on my .com live as I type. Very low friction. I did see Hugo, Jekyll, & Pelican do similar, but it was straightfoward enough to just do it from scratch with Cursor, customized how I liked it.
  • by hardlyfun on 2/12/25, 4:29 AM

    I run my personal site off of Hugo. You can load some decent themes and adding new content is a relatively painless process.

    But I do feel like there is a cost to using static site generators. Raw HTML is easier to work with if you aren't dealing with a lot of similar pages.

  • by grandempire on 2/12/25, 6:29 AM

    You actually skipped making an adhoc site generator of your own.

    Make a 5 line shell script to do steps 1 and 2 for your entire site. Then the content is just a few paragraph and link tags. Throw in a call to markdown if you want to get fancy.

  • by lelanthran on 2/12/25, 4:22 AM

    The big problem was not wanting to write even a small amount of is.

    After all, a simple web component in a page of code would have allowed client side includes.

  • by asynchronousx on 2/12/25, 6:14 AM

    Hilarious post in that it mirrors my own experience. Starting writing a SFS site by hand in HTML, hated writing new things on it, decided to ditch it for a static site generator.
  • by jaw on 2/12/25, 7:18 PM

    I use a sort of intermediate approach for my personal site. It's just stored as html files in a git repo, and I do write the html by hand for pages that I want to put extra love into (e.g. an annual year-in-review post to share with family and friends). You wrote something in your original "Writing my own damn HTML" post that captures a big part of why this appeals to me: "I see my website as a sort of self-expression project - kind of like a zen garden..."

    But handcrafting html is inconvenient to do frequently, so for more ordinary posts I write in markdown and use some custom scripts and pandoc to generate html. For me this approach is more fun than using a static site generator and less annoying (because I spend less time figuring out why an upgrade randomly broke something, or how to make the SSG do things I already know how to do manually). But the only reason it hasn't devolved into a full hand-rolled SSG is that I don't need/want much consistency across pages: there's no shared nav bar and I don't try to keep the styling or layout of older pages in line with newer pages.

  • by goldencoralefan on 2/13/25, 5:02 PM

    > As a workaround, I shipped Highlight.js with all my blog articles, which I never really liked. My site was static, so why should I force users to do rendering work on their machines?

    Doesn’t the client have to do rendering work regardless or whether the HTML is served server-side or client-side?

  • by zeroq on 2/13/25, 2:31 AM

    No JS, client side code highlight using dark magic: https://blog.glyphdrawing.club/font-with-built-in-syntax-hig...
  • by xyzzy9563 on 2/12/25, 7:14 PM

    The best method I found is write in markdown and then use react-markdown on a next.js app. Kind of overkill but it works well.
  • by aqueueaqueue on 2/12/25, 7:55 AM

    Ignore the high velocity toys emanating from the strollers of leadership ... and just use WordPress.
  • by apsurd on 2/12/25, 4:34 AM

    God on Clayton to publish his thoughts on his own blog!

    That said, he's throwing the baby out with the bath water and making convoluted claims. I agree with some of them, but I'll exercise my desire to write more and reply:

    > My hope is that I’ll take advantage of this and start writing more!

    Choosing to self-publish one's blog is already at odds with "I'm doing this to write more". So blaming handwritten HTML for added friction is not so fair.

    Literally writing every single page of HTML is unnecessarily strict. As another commenter mentions, why not add a few client-side templates for header/footer, a global nav etc.

    Jekyll is really not a very ergonomic static site generator. I got GitHub famous for a hot-second because I wrote a little framework to help: https://github.com/jekyllbootstrap. TLDR: Jekyll is famous because the cofounder of GitHub made it. Not really because it's the best or even a good implementation. It's neat, it's just, why would you use that if you have access to a fully ruby runtime.

    Anyway, I love hand-writing HTML so my bias out. I don't think it's HTML's fault. HTML is super easy to write, as OP agrees.

    I made my own little website framework (of course); it's not ready for prime-time but you can peruse here: https://plusjade.com/demos/index.html

  • by TZubiri on 2/12/25, 5:02 AM

    My main issue with writing html directly is that it's not a writing workflow. I write in my notepad, or in my notepad.exe or word about lots of things, only a few of which I would end up publishing, so htmlizing was always a publishing step that starts with a source material. From that it naturally follows that it can be easily automated, and html is a great format for this in theory, but even as a programmer WYSIWYG is so powerful, I'd rather write in Word or notepad exe and THEN annotate what are the headings and etceteras.

    If you truly write directly in html, you are probably going to be writing about html or webdev, as your mind is in that headspace, and you have to tweak a lot of html stuff so that's what you get to talk about. Once you let go a bit of that primitive purism you realize you are free to think about whatever the fuck you want.

    That said I have a lot of love for speaking about the medium. When I'm feeling cynical, it feels dumb to speak about anything other than the medium. It makes sense to me that half of the discourse on twitter is about elon musk, at least it's transparent in its topical bias, on typical media the topical bias gets rerouted and engineered through ads so that you can "focus on the actual content" which is kind of dumb, I guess, I find the ads end that keep the lights on end up being more important than yet another mindless sitcom.

    So yeah, I'm torn. But whichever path is chosen, going through this drama of self hosting, tech minimalism and reinventing the wheel, is a key signature of the tech blog, it really shows the identity of the author and the work they've put into the mix of their ideas and their web space, in a way that, say, a wordpress instance, cannot fulfill.

  • by ljlolel on 2/12/25, 4:19 AM

    I’ve felt the pain
  • by Nijikokun on 2/12/25, 4:25 AM

    Honestly, I thought this was going to be another AI post. TIL about zola. Looks cool.
  • by dangus on 2/12/25, 7:15 AM

    I mean, no shit dealing with raw HTML sucks. I really don’t understand why technical people get in their own way.

    Even something like a squarespace site is worth the proprietary commercial money if you enjoy blogging.

  • by eviks on 2/12/25, 7:41 AM

    > handwriting HTML is honestly not that hard

    proceeding with all the steps that make it hard...

    > exercise in pointless manual labor

    This is exactly correct! Let the tools do their job and insert all the spans/tags/etc. that a browser expects, devote your energy to the content!

  • by whatever1 on 2/12/25, 7:29 AM

    Html and xml are prime examples of why code prettiness is super important for the developer experience. Markdown and JSON exist because the above are plain ugly.