7 ms·
Ask HN: Does anyone write HTML anymore?
I jest about this, but it's interesting to observe that many personal websites nowadays heavily rely on JavaScript to render even the most basic text content. In fact, some of these sites become entirely non-functional if JavaScript is disabled.
Let me clarify, I've been using JavaScript since a time when people would tease me for not coding in Flash, as it was considered the future language of web development.
I was creating SPAs (single page applications) long before I even knew what the acronym SPA stood for. I've been crafting React frontends for at least six years now (and "vanilla" for at least 10 years prior to that), so you could say I've had my fair share of JavaScript coding experience.
I understand that tools like Next.js and Remix allow you to generate server-side React that ultimately produces plain HTML output. However, what if I don't want a backend at all and still desire straightforward HTML output? (And yes, I know about static site generators; I'm even building one of my own.)
My main concern is that while search engines can certainly parse JavaScript, I suspect that they still perform best with HTML. Many websites may be missing out on better search engine results because they aren't optimized for discoverability through traditional HTML content.
- DamonHD 3y agoYes, I write plain HTML, and have done since 199-<cough>, with JS sprinkles in sometimes. Most of the pages of my current main site have no JS at all. Almost all (there are some legit exceptions, but not many, IMHO) pages should be functional (even if maybe less pretty) with JS turned off.
- jzombie 3y agoYeah, I think these days it is almost an art to not use JS. Saw a purely text-based blog use it the other day to generate the site nav... all in text... just links. Could not even see the text links without JS enabled.
- spansoa 3y agoJS is an embellishment. Think of an electric stairs, it still works even with no power. I do all my sites like this. It must work without JS, because some users disable JS for privacy or accessibility reasons, and I care about those users.
- jzombie 3y agoNice analogy about the stairs.
- adamredwoods 3y ago>> I understand that tools like Next.js and Remix allow you to generate server-side React that ultimately produces plain HTML output. However, what if I don't want a backend at all and still desire straightforward HTML output? Then write HTML? I don't understand what you are insinuating at all. Is this a hard stance? The web is flexible enough these days to allow javascript or for you to write HTML if you want to, which you seem to desire.
- jzombie 3y agoMy point is that for certain types of content, especially simple blogs, relying solely on JavaScript can create unnecessary dependencies. It's not a hard stance but rather a consideration of the trade-offs between convenience and accessibility.
- vlod 3y agoIf you want 'some' interactivity (i.e. minimal js), it might be worth taking a look at htmx. i.e. Page is mostly static, but if click 'add' etc, generate html from the server and insert it into the dom using attributes.
- jzombie 3y agoHave heard a lot of good things about HTMX. I enjoy writing JS. It's actually my favorite programming language. But there are plenty of times when it's unnecessary.
- devonnull 3y agoThere definitely are more than a few people who hand code the HTML for their sites. Often, it's people who need something simple -- no scripting, no database back end, none of that stuff. Just HTML and maybe some simple CSS. I know a couple of people who build their (infrequently updated) sites using Markdown, pandoc, a custom HTML template, and a simple shell script.
- jzombie 3y agoYeah, Markdown + a custom template is the approach that I've recently been taking, though using Python instead of the shell script (but the shell script would be more interesting, now that I think about it).
- devonnull 3y agoThe shell scripts used by the people I know are pretty simple, encapsulating the string of pandoc commands and pointing to an HTML template. Nothing fancy -- just a convenience when running a tool that they don't use very often.
- legitster 3y agoI still do a lot of hand-coded and static HTML. I'm old-school and have a lot of muscle memory, so 9/10 it's just faster for me to throw together a page of HTML for a custom project and throw it in a directory than to muck about with a CMS or anything server-side. > My main concern is that while search engines can certainly parse JavaScript, I suspect that they still perform best with HTML. This isn't really true anymore, and the evidence for this is that Google themselves uses user-facing JS for lots of applications. Regardless, you can still assess the SEO friendliness of any page with the available tools. That said, there is a good case that you should reduce the complexity of your page whenever possible. If you can get away without a bunch of JS calls, you are introducing fewer things that can introduce mistakes or performance problems.
- jzombie 3y agoI agree. Simplicity is better.
- MilnerRoute 3y agoIt's interesting think about people who, when they need a web site, turn to Wordpress. There's HTML, which they're not really writing themselves. But there's also a lot of PHP.
- jzombie 3y agoMarkdown-driven static site generators would probably fulfill a majority of those use cases as well.