23 ms·
Rewriting my website in plain HTML and CSS
- jsheard 2y agoI'm surprised to not see Astro mentioned, its whole schtick is providing very similar DX to frameworks like SvelteKit except in a way that's geared towards generating plain HTML/CSS with zero JS by default. You get things like components with scoped styles but they are compiled down to nothing. It's really a breath of fresh air.
- pantathei 2y agoYep -- I rewrote my blog over new year's with Astro and am pretty happy w easy markdown and a bundle size of zero bytes.
- yawnxyz 2y agoOnce I randomly discovered Astro, I couldn't go back. I love that you can even drop in Svelte and React blocks right next to each other, so you basically the power of all the advanced frameworks, and the choice to pare it down to a barebones html static site
- deleted 2y ago[deleted]
- mplewis 2y agoAstro is my favorite tool for static sites these days. It's wonderful.
- aziis98 2y agoYeah I really like Astro too, I often just start with the minimal template [1] that is just a couple of files. I used to do many experiments with custom SSG some time ago but since Astro came out I can't change back anymore. If you don't want js on the frontend you can just use it as a nice html templating engine. It also renders markdown automatically for you as it recognizes different formats by the file extension. [1]: https://github.com/withastro/astro/tree/main/examples/minimal https://github.com/withastro/astro/tree/main/examples/minima...
- hollowturtle 2y agoNice job! If only HTML had a serious templating system(no the template tag isn’t enough) that could be used without JavaScript, we won’t need any 3rd party system for assembling static sites. For example a mechanism for including partials with the <link> tag and refer them inside a <template> or directly into current html
- ZYbCRq22HbJ2y7 2y agohttps://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe https://developer.mozilla.org/en-US/docs/Web/HTML/Element/if... https://developer.mozilla.org/en-US/docs/Web/HTML/Element/portal https://developer.mozilla.org/en-US/docs/Web/HTML/Element/po... https://en.wikipedia.org/wiki/Server_Side_Includes https://en.wikipedia.org/wiki/Server_Side_Includes Also, other than to satisfy a purist desire, why do you need this? You can pre-render HTML quickly using a variety of template systems, and it would outperform what you are suggesting every time (from a client's perspective). I mean, think about the potential CSS resolution complexity, FOUC, etc.
- recursive 2y agoIn the 90s, we used Server Side Includes (SSI) for this. Probably still works.
- skyfaller 2y agoOne modern approach would be Caddy Server's templates, using Golang templating: https://caddyserver.com/docs/modules/http.handlers.templates https://caddyserver.com/docs/modules/http.handlers.templates The "include" function should do the job: {{include "path/to/file.html"}}
- ZYbCRq22HbJ2y7 2y agohttpd, nginx, a number of other servers support SSI https://nginx.org/en/docs/http/ngx_http_ssi_module.html https://nginx.org/en/docs/http/ngx_http_ssi_module.html Caddy chose not to, I guess? https://caddy.community/t/caddy-update-on-ssi-server-side-includes/400 https://caddy.community/t/caddy-update-on-ssi-server-side-in...
- riidom 2y agoI did kinda the same thing. Not being a backend dev didn't stop me using some PHP, basically as template language. It has a few downsides as well, but overall I am happy with it.
- gwynforthewyn 2y agoI decided to do write from scratch for my own site, and found that a real burden was maintaining lists of pages: there was no framework helping me out, and every time I added a new page I had to remember to go update my list of blog posts in the 2 or 3 pages I could access it from. To solve that and other issues, like adding an rss feed and letting pages specify their own publish date, I did what anyone would do: write a custom web server. It's up at https://github.com/playtechnique/andrew/ https://github.com/playtechnique/andrew/, if anyone wants to give it a whirl.
- AdrianB1 2y agoA few lines of PHP can solve that. The difference to other solutions is you don't have to compile/build/CI-CD it, just copy the PHP files in a folder, change a few things in the ini and you are ready to go.
- gwynforthewyn 2y agoFor sure! PHP's a great language and tool! You'll still need a web server and modphp or something, and that web server was still probably compiled, but of course with bigger projects you can often get them from your distribution's package manager. A little project like mine isn't the right answer for everyone; right now its only user is me. How it solves the problem fits my own little brain : )
- AdrianB1 2y agoYou don't need a web server, for small stuff "php -S 8000" runs it for you.
- SuboptimalEng 2y agoI started a portfolio website with Netlify (iirc), then I moved to Vue + Gridsome (on GitHub pages), then Next.js with Tailwind CSS, and was about to move to Vite.js over winter break. That's 4 stacks over the course of 5-6 years. Not worth it. Decided to do the sensible thing and use GitHub's README functionality. I prefer this approach and wish more folks in the tech community adopted it: https://github.com/SuboptimalEng https://github.com/SuboptimalEng
- dvt 2y agoGitHub was just down the other day. Why would you want your personal website/portfolio to be tied to GitHub? Crazy "modern web dev" stacks are likely overkill, but that's not an argument against self-hosting.
- sneak 2y agoPersonal websites can be down a few days a month without a problem.
- 8n4vidtmkvmk 2y ago+1. Not like my $5 hosting plan has less downtime than Github. Well... maybe? Fewer moving parts perhaps. But it's not immune.
- mr_mitm 2y agoBecause it's free and convenient, and other hosting providers don't magically have 100% uptime either. Not even necessarily more uptime than GitHub.
- zahlman 2y agoHow is it "tied"? You still have a local repo that you could deploy somewhere else.
- BrandoElFollito 2y agoI like to think that when GitHub (or Google, or Netflix, ...) are down, I am not alone. A few million people are holding their breath - unlike in the case of my self-hosted site where I am alone to bring it back online.
- wonger_ 2y agoHere's some of my tips for a handwritten HTML site, since the author wished more tips existed: - consider using an HTML boilerplate template like this one if you don't know where to start: https://www.matuzo.at/blog/html-boilerplate/ https://www.matuzo.at/blog/html-boilerplate/ - consider using a CSS template, or a CSS reset, if you don't know where to start with styling. Pico CSS is a good drop-in: https://picocss.com/ https://picocss.com/. Frontend devs always blog about their CSS resets, like this one: https://piccalil.li/blog/a-more-modern-css-reset/ https://piccalil.li/blog/a-more-modern-css-reset/. But if you're someone inclined to write their own HTML, then you'll probably also want to write your own CSS. This takes time to learn. Especially learning how to design the page without looking crappy - I copy my last page as a template whenever writing a new page - I don't worry about code duplication. If I need to refactor duplicated content, I use search and replace across files in vim (like https://nithinbekal.com/posts/vim-search-replace/ https://nithinbekal.com/posts/vim-search-replace/). Hopefully your editor/IDE has something similar, and hopefully you're comfortable with regexes - markdown + pandoc + scripting is a common solution. Technically it's not handwriting HTML at this point -- it's hacking together your own static site generator instead of using an existing framework -- but no biggie - frontend people have made a lot of live reload tools over time. Here's a couple: https://nitoyon.github.io/livereloadx/ https://nitoyon.github.io/livereloadx/ and https://github.com/tapio/live-server https://github.com/tapio/live-server. Personally, I've cobbled together something with entr/caddy/websockets/userscripts. I've had problems with `python -m http.server` freezing up occasionally, but YMMV - About RSS: you can generate your own feed if you already started your own generator script. Personally, I let this tool generate a feed for me in a GitHub Action: https://feed-me-up-scotty.vincenttunru.com/ https://feed-me-up-scotty.vincenttunru.com/, but the feed quality is meh - Expect to do a lot of fiddling. You'll reinvent things. You'll lack common features for a while. Embrace this as minimalism. You'll begin to appreciate the tasks that frameworks automate (image optimization, compression, meta tags, validation, etc) - You'll face growing pains after you cross certain thresholds of page counts. Personally, I'd rather be grug-brained and edit more HTML than figure out some new framework. This is fine for a personal website with a straightforward structure
- nyarlathotep_ 2y agoGreat resources, cheers for this. Totally forgot about CSS resets.
- epolanski 2y agoWhen I used to do interviews to frontend developers I often had them write a form with validation...in plain HTML and a sprinkle of js for some of the final validation touches. Was kinda surprised at how many senior leetcode blackbelts didn't know HTML had built in validation :) JS was required for some of the more complex validation logic and mounting few dom nodes (and again, surprisingly, many didn't know how to create an element and mount it!). On the other hand I got to learn lots of nice tricks to complete some of the features (elements had to appear with conditional logic) with CSS only which was nice.
- AdrianB1 2y agoHTML has built in validation, but the behavior and control over it is not great. I am using it in my projects to some extent, but it does not cover 100% of the needs. Because of that, some people skip it completely and almost forget it does exist.
- zahlman 2y ago>Was kinda surprised at how many senior leetcode blackbelts didn't know HTML had built in validation :) Judging by the websites I've had to deal with in the last few years, a lot of web devs don't know that HTML has built in form submission. Or that it's possible to, say, display images without JavaScript (looking squarely at you, Imgur).
- catapart 2y agoGood on ya! HTML+JS is plenty performant for a blog and I'm always happy to see more people eschewing frameworks when they're not necessary. I've been writing a progressive web app that is, itself, a "web component" (custom element), built entirely with custom elements, so I feel like I've got a pretty good idea of how you can tackle that header reuse bullet point. Happy to give pointers if you're interested in that at all. Anyway, great job on simplifying things! I hope it gets easier from here!
- robertlagrant 2y agoI think it's rarely about performance and more about organisation. If there's only one developer and it's fairly basic, you neither need the code organising nor state propagation benefits that come with most modern frameworks.
- numpy-thagoras 2y agoHugo is also nice for this, and allows for markdown, embedding Mathjax or LaTeX, etc. Your minimal approach mirrors some of what I've seen in Hugo or Astro, and I'm all for it. I wish we had truly minimalist SSGs, I think the idea has a lot of purchase.
- uncheckederror 2y agoI've been maintaining my personal website as plain HTML for five years now. I must say, I quite like this method. There's no substitute for practice when it comes to maintaining your skills at editing HTML and CSS. Yes, you must copy and paste content and not having layout page is annoying at times. But the overhead of just doing it yourself is surprisingly small in terms of the time commitment. Typically, I'll draft a post in MS Word then open the git repo for my site, hosted on github pages, duplicate and rename the template.html page that includes the CSS, footer, and header for my site and then copy my content into it. When I'm happy with everything, I'll make my commit and then a minute later it's live at my custom domain. Seeing that it takes only 11KBs and 26ms to load my landing page strangely delightful.
- culi 2y ago> 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 instead!
- 8organicbits 2y agoI've adopted the idea that a blog post is archived when it's published; I don't want to tinker with it again. Old pages may have an old style, but that's OK, it's an archive. Copy/paste works great for this. The only reason I use a blog engine now (Hugo) is for RSS. I kept messing up or forgetting manual RSS edits.
- promiseofbeans 2y agoI really love this! I've seen it in action a couple times in the wild, and it's super cool seeing how the site's design has evolved over time. It also has the benefit of forcing you to keep your URIs stable. Cool URIs don't change: https://www.w3.org/Provider/Style/URI.html https://www.w3.org/Provider/Style/URI.html
- azangru 2y agoDid he reinvent a static-site generator? Markdown, pandoc, makefile... Sounds like a job for hugo/eleventy/jekyll/whatever.
- Ugvx 2y agoIts the the first time someone has reinvented a static site generator... Looks around sheepishly
- deleted 2y ago[deleted]
- NoboruWataya 2y agoI don't maintain a blog so my opinion may not count for much, but I feel like if what you are trying to do doesn't fit neatly into an SSG's existing templates/themes, it may in fact be easier just to use pandoc and some simple tooling around it. Certainly when I looked into a few SSGs for the purpose of making a simple personal website (without a blog) I found I would spend more time trying to bend them to my will than just writing what I want in markdown and running pandoc on it.
- WorldMaker 2y agoMost of them bend to your will very easily if you are the one writing the HTML and not trying to use an existing template/theme. Even Jekyll the "themes" are optional and you can entirely ignore them. Also most of the complexity disappears if you aren't trying to make a blog. They generally all have "simple pages" support that is much simpler than trying to figure out their blog mechanics. Of course the hard part is picking an SSG you like, and it is easier to just build your own which is a big part of why SSG proliferation happens. Too many options? Make a new one. My main sites are still in Jekyll for now, for historic reasons of GitHub Pages support. My latest discovery and new love in this space is Lume [0]. It's definitely on the simpler side of the scale. I haven't tried it for a full blog yet, but the simple website I have built with it has indeed continued to feel simple throughout the process and even using some of the features Lume's documentation labels "Advanced". [0] https://lume.land/ https://lume.land/
- lapcat 2y agoI write my website and blog directly and entirely in HTML using BBEdit. For me, this is just much easier than any other method. I don't have to rely on any external system.
- tkgally 2y agoSame here. Any text editor would work, of course, but I like BBEdit because of all the customization options. I’ve set up a bunch of shortcuts for frequently used tags; after some practice, I’ve become able to write prose in HTML almost as smoothly as in a word processor. When I redid my ancient personal site—started in the late 1990s—to make it mobile-friendly a few years ago, BBEdit was also useful when making changes across dozens of files at once.
- mikae1 2y agoAnd does your blog have RSS or Atom feed? That's usually where it becomes a little tedious.
- oneeyedpigeon 2y agoYou just need a build system in place - generating RSS from your collection of html files isn't difficult.
- lapcat 2y agoOf course. It's not a blog without RSS! Believe it or not, I also manually edit that in BBEdit.
- mikae1 2y agoI'm impressed, that's grit!
- cmdtab 2y agoRecently 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] https://saksham.work https://saksham.work
- zxor 2y agoAdding validation/access control to server actions is pretty much the same as for API endpoints though? I'm not sure next.js is the right fit for a blog/personal site either, but that's an odd point imo. Your site looks very nice though!
- cmdtab 2y ago[dead]
- tazjin 2y agoI'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?
- wvenable 2y agoI also decided to develop my personal website in plain HTML. I looked into a bunch of static site generators and found that direction to be too complicated and slow for me. I still wanted the ability to have a common headers and footers and unique sections without repeating myself in every file. So I created a very small PHP application (just 5 files) and each page or blog post is a single PHP file in a directory. These PHP files have a small bit of metadata code at the top but are otherwise just plain HTML files. In each directory is layout file that wraps the content and these nest up the directory structure. So my site has a common header and footer and each section has their own subheader. With the ability to publish by git push to the server, writing a blog post is as easy as creating a new file, git commit, and git push.
- Brajeshwar 2y agoIf you OK using a tiny tad JavaScript, it should be able to re-write that portion of the DOM to have HEADER and FOOTER common. Nonetheless, if you are also OK using Github, it has built-in setup where you blog in Plain-text (MarkDown) and things just works. You don't even need to build it on your local machine. I wrote about it when I moved from WordPress to Jekyll. https://brajeshwar.com/2021/brajeshwar.com-2021/ https://brajeshwar.com/2021/brajeshwar.com-2021/
- BeetleB 2y agoAs others have said, you are reinventing the Static Site Generator. I would strongly urge you to look into those. If you know Python well enough, my recommendation is Pelican.[1] You can author your posts in Markdown. You specify the desired HTML/CSS. It will then do all the boring work for you. Then just upload the static files to a webserver. [1] https://getpelican.com/ https://getpelican.com/
- pittma 2y agoI have a pretty elaborate Hakyll site with custom routers and all kinds of junk (https://dpitt.me https://dpitt.me), but it's an old site that started as Django, then I built it from scratch with Sinatra, and then was Jekyll for years. There really is something special about a well-organized static site. For all the rewrites of this old thing, I can't imagine moving away from static site generation.
- afarah1 2y agoI do mostly the same, .md and pandoc, but also mo for templating: https://github.com/tests-always-included/mo https://github.com/tests-always-included/mo. Took just a few minutes to setup. E.g. https://afarah.info/public/blog/awsv3/index.html https://afarah.info/public/blog/awsv3/index.html. Writing in Markdown with {{mustache}} templates for DRY is very satisfying, a simple bash script renders it. Looks good on my phone even.
- pfych 2y agoThis is exactly how I generate my site[^1]. Except I use a simple Node script to handle hosting a tiny HTTP server. Node calls pandoc, which converts my markdown into HTML, ESBuild to convert the few JS snippets I run on my site (which I write in TS), and SASS to convert my scss stylesheet into a bundled CSS sheet. It's super lightweight and I like that I can bend it to do whatever weird shit I want my site to have without relying on a 3rd party static site generator. [^1]: https://pfy.ch https://pfy.ch
- masswerk 2y agoWhat I like to do: - have HTML files for the individual pages/posts (I like the freedom that custom HTML provides) - have a script file consisting just of a single array of meta data blocks for the individual posts (headline, description, preview image(s), date, tags, additional assets to load, like additional CSS or JS, if required, restricted visibility, etc. – most of this is optional) and content for the preview - a server-side template script that generates the chrome around an individual page view and a paginated list view from the feed data (this allows for things like pagination, cross-links, filters per tag, we can generate multiple views), and we can also generate a RRS feed from the feed-index. Moreover, as there is also no external input other than fragments from the request URI, which can be laundered easily (e.g., by discarding all non alpha-numeric characters) and checked for resolving to existing file paths in given constraints, this should be also considerably secure. (This is actually a rather short script.) - a server config (`.htaccess` or similar) that parses parts of the request URL to parameters to be used by the template script. (So, adding a post is as simple as adding a new HTML file, copying an entry in the feed file and modifying it accordingly for the new page. And it can be done all in a text editor. The only thing missing may be a full-text search, as there is no DB involved and no representation of the content as normalized plain text. On the other hand, this also keeps the server load low.)
- enmyj 2y agoLots of people saying they did something similar, so I'll add that I also did something similar for learning / fun(?) with the added wrinkle that it runs on a raspberry pi at my house. I used golang's Fiber to serve the html/css. Fiber comes with some built-in templating as well to help with the layout. https://www.ianmyjer.com/content/homelab.md https://www.ianmyjer.com/content/homelab.md
- insonable 2y agoThere's a lot you can do with just plain html these days if you just need a clean site. Here's an example from my recipe site (https://xilic.com/recipia/sauces/pesto_traditional.html https://xilic.com/recipia/sauces/pesto_traditional.html), mostly for my personal use or sharing with friends, with only html/css. It has expandable boxes, a menu system, etc. A simple script converts a directory structure of .csv files to these recipe cards with a template, and this way you can edit the sources in a spreadsheet and then the publish script just takes whatever is new and re-does the whole lot of html as necessary. Just like we used to do with Apache Forest!
- makizar 2y agoWhat a beautiful website ! Feels carefully crafted, full of nice moments like the > turning the a - when sections are open in the TOC. Would love to hear more detail on how you went about making it. Did you ever consider sharing parts of the source code ?
- insonable 2y agothanks! i first just made a sample html the way i thought it would be nice, then made that into a templeate, and wrote a python script generate the site. it first scans for all the files to build the menu and homepage, then goes file-by-file to make each one, filling in the blanks in the template as you can imagine. it was pretty natural since my spreadsheets were all following the same format already anyway. i'd be surprised if there was a lot of interest, but if so i'd consider sharing the script/template etc.
- nayuki 2y agoReally appreciate that you're doing mass-based recipes, and in metric too. I'm tired of all the American recipes with quantities like "2 1/3 cups"; the proliferation of units and fractions makes work needlessly hard compared to just grams and millilitres.
- 0xEF 2y agoFurthermore, when it comes to recipes for baking, if it's not using weight as a measure, then it's wrong. Baking is chemistry, so if you want consistent controlled results, stop measuring anything by volume. Sorry, pet peeve of mine as a hobby baker.
- TheSisb2 2y agoLove this. Building a website this way really teaches you why we started having all the complexities in web frameworks today. For certain simple websites like this one, the tradeoffs are worth it. I rebuilt our company website this way too. (Sescollc.com)
- chazeon 2y agoThere is a tool called entr, it kill and restart command when any file changes are detected, you could check it out.
- Over2Chars 2y agopandoc for the win. I use to convert my md resume into doc/pdf whatever.
- mbo 2y ago> It took me hours of Googling and trying out different options to come up with this awful piece of code that worked to load the contents of a file and give them to my page [CODE] Do I have Stockholm syndrome or is the code here completely fine?
- Petersipoi 2y agoThis whole piece kind of feels like the author just doesn't understand Svelte, so they threw it out and used something they do understand. Yes, it probably is a good idea to use technologies you understand. But you not understanding Svelte isn't a Svelte problem.
- jasonjmcghee 2y agoTo contribute to the authors open questions at the bottom: for reusability, use web components [1] and for hot reload use a file watcher with a websocket, or just lean on your ide if possible (e.g. jetbrains). [1]: https://developer.mozilla.org/en-US/docs/Web/API/Web_components https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...
- 0x38B 2y agoThe CSS for this site (root.css) is beautifully simple! The colors, spacing, and fonts are very comfy - this is exactly the look I'd want for my blog.
- bpiroman 2y agowe need more of this. Thanks for sharing!!
- i_love_retros 2y agoWhy on earth would you use something like sveltekit in the first place for such a simple website? I know people will say for the learning experience but learning what? How to basically "hello, world" in sveltekit?
- seanvelasco 2y agowhy wouldn't one use sveltekit if they only have html and css? sveltekit compiles to a static site with a nice client-side router. sveltekit is basically html + css in a .svelte file if you don't use javascript.
- joshdavham 2y ago> spending too much time on Hacker News gave me the misconception that writing a website using plain HTML and CSS would be a relatively well-paved path in 2025. I spent some time looking around for guides or a “canonical” way of doing this and found that there isn’t really one. I had this exact same surprise last year! For whatever reason, there really isn't any sort of standard way of creating a vanilla site in 2025!
- fractorial 2y agoFWIW I just import a canned CSS theme (Terminal CSS), MathJax, and the roll the rest in raw HTML; it’s simple and maintainable.
- 8n4vidtmkvmk 2y agoI think PhpStorm/WebStorm has LiveReload built into it. It's been years since I've used it since I don't usually write plain HTML/CSS. But it was just a button click away IIRC. You shouldn't need to restart any servers no matter what you do anyway, just press F5. Still not hard. I use PHP+Twig on my simple websites just so I don't have to copy-paste the header/footer/nav. It's still incredibly simple, very close to HTML+CSS and no build times. You can FTP upload your files if you want it works.
- tolerance 2y agoThe best thing about this post to me was the screenshot of the directory organization. It’s the little things like this that making thinking “how to start” a matter of “where could I start”.
- yakkomajuri 2y agoYou might find Teeny (https://github.com/yakkomajuri/teeny https://github.com/yakkomajuri/teeny) interesting for this. Something I built to have my own site in static HTML and CSS.
- revskill 2y agotext is not json.
- superkuh 2y agoPlain HTML and CSS personal site experience can be vastly improved by using server side includes. Your webserver's SSI module is likely just the right amount of templating power so you don't have to re-write the same HTML in $x spots with a minimal attack surface and maintenance burden. SSI hasn't changed in 20 years and the nginx module at least hasn't even ever had a cve. <!--# include file="/menu.html" --> ... <!--# include file="/footer.html" --> This type of ssi templating is extremely useful for static HTML sites using .html (and other) files on filesystems. I've been using it since hosting my website on my 56k modem in 1999 with Xitami server on Win98. Now I do it hosting from my cable modem in 2025 with nginx on linux.
- robgibbons 2y agoSSI's were my first foray into "backend," if you can even call it that, sometime around the year 2000. Some benevolent commenter on Slashdot gave me the tipoff, and my growing frustration with copy-pasting HTML snippets between pages was henceforth a thing of the past. Then came PHP, Python, et cetera, and the rest is history. Amazing how such a simple mechanism can remain useful even decades later.
- planetjones 2y agoHugo worked for me. And as part of the GitHub pipeline that builds the site and deploys it I can grab some ‘dynamic’ content (from a Notion DB) and render it. Subsequently I added Zapier so that when the Notion DB changes it triggers the pipeline to update my website. The only thing I pay for is the web hosting with dreamhost. https://www.planetjones.net/blog/03-05-2023/relaunching-my-personal-website-as-planetjones-dot-net.html https://www.planetjones.net/blog/03-05-2023/relaunching-my-p...
- andrewflnr 2y agoWriting your own static site generator is good for you. I'm using raw Jinja2 templates and a tiny python script to do my shared header/styles etc. Outside of that it's all shell scripts and raw HTML/CSS.
- t312227 2y agohello, as always: imho. ad "duplicated (html) code" in static webpages: back in the 1990ties when a lot of people wrote html by hand, there was a thing called "server side includes" ... * https://en.wikipedia.org/wiki/Server_Side_Includes https://en.wikipedia.org/wiki/Server_Side_Includes or just use some "ubiquitous" script-language like php for this simple task of orchestrating/including snippets/components of code etc. :) just my 0.02€
- TibbityFlanders 2y ago[dead]
- deleted 2y ago[deleted]
- vaibhavkul 2y ago> the only Javascript on the site now is to highlight code Couldn't the code highlighting be also handled statically during the build process?
- paulmooreparks 2y agoI took a similar approach, but I still have a dynamic site generator that reads my HTML content and outputs it to a template. I write all of my pages as stand-alone HTML, and each page can render on its own without any of the template being present. For example: https://parkscomputing.com/page/conways-game-of-life https://parkscomputing.com/page/conways-game-of-life Is supported underneath by the raw HTML: https://parkscomputing.com/content/conways-game-of-life.html https://parkscomputing.com/content/conways-game-of-life.html The menu and main page are controlled by a JSON configuration. The site is slow right now because I'm being stingy on the Azure storage performance.
- erremerre 2y agoI have found someone who uses the anchor suffix to solve the problem: https://john-doe.neocities.org/ https://john-doe.neocities.org/ I am not html expert, so I have no idea how complicate or what implications would that have.
- nbbaier 2y agoI love this site and concept and have been thinking about moving to this method for my own site
- benchly 2y agoSame. This would work really well for my site, I think, although I worry slightly about latency as it scales and I add more and more photos. That is not so much a problem right now, but it might impose some latency later.
- nbbaier 2y agoYeah. I don't know if it scales to adding a blog either, which I have been thinking about doing.
- sira04 2y agoThis is quite neat. Every page is a <section id="pageid"> and css is section {display:none} section:target {display:block} So they use the target selector which becomes active when #pageid is in the url. But the html for all the pages is outputted, so this won't scale with a big blog. I wonder how SEO is for this, and if there's a way to make this better with something like the <object> element. I would also make it so the url was example.com/#/pageid, so the id is "/pageid". Looks a bit better I think.
- erremerre 2y agoWhat do you have in mind? I was thinking in using it for a blog, but I am afraid of having everything in a single file, and that making some mistake will render the whole site useless. Also not sure how hard would be to manage once it starts to grow... Maybe it needs to grow significantly more than I can before this is a road block.
- bob1029 2y agoWith 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, ...) => $@" <html> (common elements) {innerHtml} (common elements) </html>"; Which is then fed html partial snippets generated however you see fit. The use of methods to abstract partials in a hierarchical fashion like this can manage complex layouts well. You can recurse and compose this structure as much as needed (i.e., partials inside partials).
- AsianOtter 2y agoIt looks like PHP is ideal.
- eviks 2y agoBefore > Why? It took me hours of Googling After > How? I spent some time looking around for guides or a “canonical” way of doing this and found that there isn’t really one. Sounds like no benefit in reducing the costs to achieve a less functional site (see next steps, which would require more googling)
- begueradj 2y agoHow is code syntax highlighting achieved in this context ?
- Bengalilol 2y agoBrowser -> show source -> inspect element You then see that it uses highlight.js
- begueradj 2y agoThank you.
- gcv 2y agoHey, Query [1] creator here. The article raised some exciting challenges. With Query, we solve booth downsides mentioned in it. To keep things simple, we use EventSource for live reloading [2] and JSX Server-Side Rendering [3] for those who want component reuse in the server. It's just JSX with some helpful extras. I'm happy to elaborate on the technical decisions if anyone's curious. A couple of days ago, I wrote an article about it: https://dev.to/gc-victor/building-static-html-pages-with-jsx-server-side-rendering-5cbi https://dev.to/gc-victor/building-static-html-pages-with-jsx... [1] https://qery.io https://qery.io [2] https://github.com/gc-victor/query/tree/main/examples/minimal/src/pages/hot-reload https://github.com/gc-victor/query/tree/main/examples/minima... [3] https://qery.io/docs/modules/function.html#jsx-server-side https://qery.io/docs/modules/function.html#jsx-server-side
- noisy_boy 2y agoWhat resource is good for gaining a deep and comprehensive knowledge of html for someone already familiar with html, like, having-written-Angular/JavaScript/jQuery-level familiar? Consider CSS to be out of scope of this question as it is a different beast on its own.
- ykonstant 2y agoThat 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
- bilekas 2y ago> More code duplication. SvelteKit has a component system so I could make my navigation bar as a component and reuse it. I'm no front-end developer by any means, but arent native web components a thing now ? https://developer.mozilla.org/en-US/docs/Web/API/Web_components https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...
- beka-tom 2y agoPandoc really looks like a nice tool
- misiek08 2y agoFunny how things like ESI/SSI would make such pages very easy to prepare and serve, but we switched to whole V8 engine to render HTML from almost-HTML syntax :)
- dep_b 2y agoI'm using PHP includes and don't think I have any JS besides Matomo tracking. I just read that I can use <object> for those includes now, so I can drop another layer of complexity. The only thing I have is a blog post navigator, that shows you all blog posts besides the current one.
- bArray 2y ago> My project tree got a lot simpler and the only Javascript on the site now is to highlight code. You can do away with the JS with something like Pandoc Highlight Filter: https://gitlab.com/danbarry16/pandoc-highlight-filter https://gitlab.com/danbarry16/pandoc-highlight-filter Just take the Python file, make it executable and add it to the filter arguments. It's very basic, but all done during build time. It was originally started to build out HTML documentation for a system that was very particular about what types of files could be used. It can also do other stuff like build your site with Python blocks that are run: https://gitlab.com/danbarry16/pandoc-highlight-filter/-/blob/master/test/python_executor.md?ref_type=heads https://gitlab.com/danbarry16/pandoc-highlight-filter/-/blob...
- bschwindHN 2y agoA few years ago, me and a coworker redid our company's website in straight-up HTML, JS, and CSS without a framework. It was quite refreshing but it certainly took longer to complete it all. It had 3D models and some scroll-based masking on videos and such. It has sadly been replaced by a website made in Framer due to time constraints, but the old version is on the Wayback Machine: https://web.archive.org/web/20211008131609/https://tonari.no/ https://web.archive.org/web/20211008131609/https://tonari.no... Unfortunately it kinda turned into a flickery mess, not sure if that's an old bug of ours or something failing to load properly from the archive. Oh well!
- fjfaase 2y agoIn 1995, I started with a personal website based on HTML. Since then, I have added a little bit of CSS to the home page, but all the other files are in plain HTML. For that reason it looks very old school, but that is okay with me. I have been adding some JavaScript through the years. Some for generating content, some for graphics and animations. I also have written a C program for checking the HTML and all the internal links and the use of tags. The program places all updated files into a folder ready for upload with FTP. To edit the HTML, I use an editor (based on Crystal Edit) that also can navigate HTML files: when pressing F5 on a link, it opens the file in the editor (or in the default browser when it is an external link), and if there a tag in the link, positions the cursor at that line. See for more details: https://www.iwriteiam.nl/SiteMain.html https://www.iwriteiam.nl/SiteMain.html
- masfoobar 2y agoI am falling back to 'plain and simple' in the world of web applications (or a website) While I am a programmer, I will continue to write code that injects html text with another... like a layout having a title and body html, etc. I certianly limit my client-side codebase. Most of my javascript code is really focused on GUI/UI, even if I have to use a specific library. I dont bother with React or the like. I will use htmx if I want to do partial updates. Other pages might be a tad more complicated if fetching data from SQL. However, I also have pages that are SIMPLY HTML+CSS!! As I say - plain and simple.
- vladkens 2y agoHi. The blog looks good. A few things to make it better: 1) You can use watchexec https://watchexec.github.io/ https://watchexec.github.io/ to live reload during development. 2) Also, please add a clickable image preview (you can use this lib for example https://github.com/francoischalifour/medium-zoom https://github.com/francoischalifour/medium-zoom) 3) No commenting feature, luckily I found your post here on HN. But it would be better to have comment blocks, like from https://giscus.app/ https://giscus.app/ or just a link where readers can comment. 4) No RSS feed. I'd like to subscribe to your updates, but there is no such option right now. RSS is one of the points why site generators are used for static blogs (e.g. Hugo, Zola, Astro, etc.)
- blmayer 2y agoGlad to hear you migrated to plain HTML and CSS, I think this creates a healthier environment: it removes bloat and is more efficient. My question is how do you update your feed, sitemap and other stuff? I've been doing it by shell scripts, I'm not 100% satisfied, I also create gemini pages from HTML, which changes content a lot. Another question: how do you handle comments to your posts? Because my blog is a static site, so there is no processing on the server end, and I don't want third parties to handle this. What I've done is adding a handler to my mail server, so it writes the mail sent to articles to the right place. And the HTML uses an <object> to load them. I don't like it either, but works. Any suggestions for this things? Thanks!
- unleaded 2y ago>My question is how do you update your feed, sitemap and other stuff? haven't tried this but maybe you could do that all in PHP and run `php feed.php > feed.html` or something regularly . and now I just realized you said you've been doing it with shell scripts and that's pretty much the same thing, maybe you could use a cron job or something. I know a lot of people don't like PHP but I believe it's still the best/simplest way to just "make my HTML run code please". and it's improved a lot in recent years as well. of course if you want to use another language you can. >Another question: how do you handle comments to your posts? you could use something like Disqus or one of the alternatives. there are self hosted ones if you really don't trust third parties but then you might as well run the web server on there (and run PHP normally). also just wondering how are you using <object> for this?
- blmayer 2y agoit goes like this: <footer> <hr> <h3>Responses:</h3> <object data=/mail/uptime.html type=text/html></object> <a href="mailto:reply@blog.terminal.pink?subject=uptime"> reply </a> </footer> so when I receive an email it is appended to this mail/uptime.html file. I don't like it because I wanted it to be just one p for each email, but the object has a whole page, like head, stylesheet, and it's separated from the outside context in some ways, not really sure.
- HackerThemAll 2y agoThe website of one of the most influential IT person, who won the court battle against U.S. Government, allowing for widespread cryptography, professor Daniel J. Bernstein, is and always has been plain HTML mostly with no CSS. https://cr.yp.to/ https://cr.yp.to/ It's served using his own HTTP server - publicfile, and the DNS domain is served using his own DNS server - djbdns. E-mail is handled using his own SMTP server - qmail. He invented the Maildir e-mail format, de facto standard in all e-mail products. All e-mail mailing lists for his products are handled by his own mailing list server - ezmlm. All of this is managed using his replacements to /etc/rc or /etc/init.d or systemd - daemontools. He invented ChaCha and Salsa stream ciphers, now in widespread use, as well as elliptic curves, especially the famous Curve25519, and the Poly1305 MAC. He also invented TCP SYN cookies. Pretty impressive, no?
- QuantumGood 2y agoThese kinds of sites really benefit from "reader"-type plugins, pushing off readability across different interfaces onto the visitor.
- XCSme 2y agoI also created something similar in PHP + Apache rewrites. I already had a PHP website, and I wanted to add a simple blog system to it, but most suggestions were complex systems that required installation. I created a .htaccess file and some PHP files to load and display markdown files from the /posts folder. It doesn't require installation (just copy-paste the files and you have a blog), and no database (posts are simply the markdown files). https://github.com/Cristy94/markdown-blog https://github.com/Cristy94/markdown-blog
- mediumsmart 2y agoI write on index.html and when the month is done it turns into month.html linked below the content on the current index.html - anything more complex is a Jekyll project sans plugins and without sass or JavaScript. but I have the emacs
- AstroJetson 2y agoI cheat with my site. I write the site in markdown in an html file. I then include the link for Markdeep (https://casual-effects.com/markdeep/ https://casual-effects.com/markdeep/) Page goes to user, markdeep does all the processing and I'm good to go. The minifed java script file is about 300kb, the size of an image.
- lizoenn 2y ago[flagged]