Skip to content(if available)orjump to list(if available)

No longer writing my own damn HTML

No longer writing my own damn HTML

97 comments

·February 12, 2025

peteforde

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.

edflsafoiewq

But all the tasks in the article are totally straight-forward SSG stuff. Why would you do some processing in a build step, but then stop half-way and ship a bunch of JS to the client so they can finish it? That only makes sense if the work is dynamic in some way that it can only be done on the client-side.

Spivak

Because you go where the good tooling is and MathJax is drop-dead simple to integrate on the client.

manuelmoreale

As a fellow no-JSer (when it comes to personal sites) for me it’s mostly about pushing myself to figure out creative solution using only what’s available within CSS and HTMl, which is a lot these days. It’s a fun exercise.

loco5niner

Sounds like the fun exercise went 'a bit' too far in this case

manuelmoreale

I think it’s up to them to decide. If they’re having fun doing it I don’t think there’s anything wrong.

Dalewyn

The ideal amount of JavaScript is zero.

IshKebab

I disagree. The gov.uk website completely eschews JavaScript at some usability cost, in particular form validation is delayed until way later than it would be if they added just a little JavaScript. It can be quite annoying.

DoingIsLearning

> The gov.uk website completely eschews JavaScript at some usability cost

I would imagine this was mostly driven by accessibility requirements more so than some ideological rigidity.

throw_m239339

I agree, but HTML widgets are not sophisticated enough not to require some amount of scripting for interactivity in many cases.

mediumsmart

I agree and with small single page sites doable but when I need to put a navigation (plus language versions etc) of the site into a mobile layout I have to do the js toggle, or do I?

account42

Why would you need JS for any of that?

ozim

It is for documents but we have web apps that are not documents.

rhubarbtree

Why?

null

[deleted]

Brajeshwar

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.

austin-cheney

I want to agree with this because I completely love markdown and it solves for so much of accessibility.

Markdown makes it challenging to write form controls (input. select, textarea, buttons) and non-visual identifiers (id, class). To solve for most of these concerns I still find I prefer to do it dynamically against the DOM as needed by user interaction.

est

same here.

Besides you can directly embed any HTML inside markdown.

Sabinus

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

rcarmo

It was likely meant as a counterpoint to it. However, I don’t really know what either story brings to the table in terms of learning value, either option has been with us since the age of CGI scripts…

austin-cheney

Yeah, people (primarily developers) have always claimed HTML is so hard to get wrong and yet failure is well above 90% after consideration for accessibility, SEO, security, and more.

defanor

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.

__d

My “static site generator” is m4 and make.

People over complicate things.

tonijn

XSLT is indeed great for this but very underestimated

Joker_vD

> 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.

natnatenathan

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.

choobacker

+1.

It's nice to have to a set of programs I moderately care about, so when I'm learning another language I can port them to it.

They're unimportant enough that I can comfortably experiment, but important enough that I want to complete the rewrite.

My "blog engine" is a nushell script that uses pandoc and built-in XML support to convert markdown into a site+feed.

account42

This is the best solution I think - you get to have things work just as you want like if you were manually writing the HTML but don't have to manually do the repetitive parts like keeping layouts and navigation synced.

Evidlo

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!

tkclough

This is really neat, I didn't know the browser would serve a page that had been generated by XSL. Is this just a hack, or is it an intended feature?

I notice, for example, that this doesn't include a <!DOCTYPE html> at the top, but it still functions because browsers accommodate incorrectly formatted HTML.

Evidlo

It's a feature! People used to build websites on this technology.

> I notice, for example, that this doesn't include a <!DOCTYPE html> at the top, but it still functions because browsers accommodate incorrectly formatted HTML.

I was just being lazy. I've added it now.

vunderba

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

james-bcn

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/

memhole

Different process, but this is my experience too. Making it super easy to go from writing to publish helps keep momentum.

Including the prompt in your write up is a nice touch.

geor9e

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.

Evidlo

Publish the PHP!

geor9e

Sure. I'm not necessarily advocating others use it, but I'll post it for the curious. https://github.com/gth001/MarkdownToHTML/

hardlyfun

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.

andrewshadura

Build times can be annoying. I have a bicycle shop's website in Hugo, full generation takes about a few dozen seconds, upload using rsync easily a minute because of many nested directories with images. I ended up writing a script to only upload changed html and new images unless needed.

wombatpm

You know there was a time when we had to wait dozens of seconds for the modem to finish its handshake before you could do anything.

vram22

80s or 70s geezer, huh?

60s grandgeezer here. try waiting a week or two, to find out that your punched card batch job didn't even compile, let alone run, because of a single character typo you made. back to square zero.

kids these days ...

null

[deleted]

grandempire

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.

genewitch

Back in the day I'd use a WYSIWYG editor to design a front page and navbar and whatever, then split each part into header, nav, footer files and have code spit out the template HTML in the correct order with "body" file chosen by the URI

This is static site generation? I had another name, basically it was CMS for people that used ms word to type blog posts

Doing this again with a markdown step sounds cool

I think a real cms just has like tag engines and the ability to group posts and that sort of thing. But a site where everything is chronological; and otherwise only "wicked" - linked via potholes in posts is really all I need.

Maybe. I do need 2 blog sites here soon. I'll try templating for one and a ssg for the other maybe.

grandempire

That’s the idea. But static site generation just means doing that templating before, so your site is a zip of html and assets.

Yeah can probably get a whole static site from a python script that loads jinja. There are lots of ways.

I just think this stuff is so easy and there is so many good tools that it is worth tailor making a solution you like.

genewitch

oh, right. so every time you want to post something you have to run the generator? i think that's why i ended up rolling my own templating thing, asking the sorts of people i set it up for to invoke some other software was a bridge too far. i don't remember how i automated moving the text from their machine to the server but it was "once it's saved it's in there" sort of thing. this was early 2000s, i stopped setting up personal sites for people around 2006.