Live data from Hacker News

Rewriting my website in plain HTML and CSS

vijayp.dev

121–130 of 218 posts

Re: Rewriting my website in plain HTML and CSS

#121
That is exactly the setup I use for my website, but I need javascript for mathjax to compile latex. Some people told me I should do it "server-side", which I presume means precompile latex and serve the equations as inline images(?) but I haven't figured out how to do it. looks around

Re: Rewriting my website in plain HTML and CSS

#122
post #28

Recently redesigned my site [1] and used nextjs app router (moved from page router). The new paradigm of adding “use server”, “use cache”, and “use client” felt too magical by default. Server actions are easy to forget adding validation and proper access control on. You need an external library to avoid the common pit falls. I’ve been contemplating whether to move to something simple. The complexity creep is real. 1]…

I'm probably getting old, and I'm not a frontend dev, but your post makes no sense to me.

I looked at your site, and if that's anything more than a single static HTML file with some resources, served by a web server, something strange is going on. There is nothing complex on your site that requires more than a handful of lines of inline JS (to shuffle the letters).

The site also scrolls slowly, especially noticeable on phones. If this was just plain HTML it wouldn't.

It feels like the baseline for web developers has become that you MUST first add a ton of extremely complex dynamic stuff, and only then can you even think about putting a single line of text on the page. There's 200kB of code being loaded for this website, what is it doing?

Re: Rewriting my website in plain HTML and CSS

#124
post #120

Earlier quoted context omitted.

Isn't using React with a static site generator framework basically the same thing but better?

Yes, it is. Unfortunately HN has a crazy bias against JavaScript (the least crazy part of the web stack) and in favour of HTML and CSS, even though the latter are worse in every meaningful way.

I don't even know where to begin with the pretence that you can compare HTML with JS and somehow conclude that one is 'better' than the other. They are totally different things. JS is for functionality, and if you're using it to serve static content, you're not using it as designed.

Re: Rewriting my website in plain HTML and CSS

#125
post #120

Earlier quoted context omitted.

Yes, it is. Unfortunately HN has a crazy bias against JavaScript (the least crazy part of the web stack) and in favour of HTML and CSS, even though the latter are worse in every meaningful way.

I don't even know where to begin with the pretence that you can compare HTML with JS and somehow conclude that one is 'better' than the other. They are totally different things. JS is for functionality, and if you're using it to serve static content, you're not using it as designed.

I don't particularly care about "designed for". If you've got to serve something to make the browser display the static content you want it to, the least unpleasant way to do so is with JS.

Re: Rewriting my website in plain HTML and CSS

#127

With regard to templating approaches, my favorite by a very wide margin is to simply use string interpolation in the base language. You create a common template type with methods like: LayoutHtml(Session? Session, string title, string innerHtml, ...) => $@" (common elements) {innerHtml} (common elements) "; Which is then fed html partial snippets generated however you see fit. The use of methods to abstract partials…

It looks like PHP is ideal.

Re: Rewriting my website in plain HTML and CSS

#128
post #24

Earlier quoted context omitted.

> Yes, you must copy and paste content Many people who maintain their own sites in vanilla web technologies tend to create reusable functions to handle this for them. It can generate headers and the like dynamically so you don't have to change it on every single page. Though that does kill the "no javascript required" aspect a lot of people like Of course you could simply add a build step to your pure HTML site inste…

I recently learned the object tag can do what I wished for in the 90s... work as an include tag: Turn your back for twenty-five years, and be amazed at what they've come up with! ;-) Should reduce a lot of boilerplate that would get out of sync on my next project, without need for templating.

Couldn't you sort of do that using server side includes back en the 90s? Assuming that your web server supported it.

Re: Rewriting my website in plain HTML and CSS

#129
post #24

Earlier quoted context omitted.

> Yes, you must copy and paste content Many people who maintain their own sites in vanilla web technologies tend to create reusable functions to handle this for them. It can generate headers and the like dynamically so you don't have to change it on every single page. Though that does kill the "no javascript required" aspect a lot of people like Of course you could simply add a build step to your pure HTML site inste…

Isn't using React with a static site generator framework basically the same thing but better?

Then you'd have to learn React, and for many of us the point is that we really don't want to learn React, or other frontend frameworks.

Re: Rewriting my website in plain HTML and CSS

#130
post #23

Did he reinvent a static-site generator? Markdown, pandoc, makefile... Sounds like a job for hugo/eleventy/jekyll/whatever.

I've tried Hugo and Jekyll a few times and they are pretty complicated. If you just want to post something online every now and then, then it might be easier to just to HTML.
Post reply on HN