Host a Static Site on Netlify in 0 Minutes

Static sites can handle anything, and so can this tiny truck. [Sludge G on Flickr]

I am amazed at how easy it is to host a static site on Netlify.

It's coming up on that time of year when one page on gun8 about why your Christmas LEDs flicker becomes popular, so I wanted to get the site switched to some kind of static site hosting to easily handle the incoming traffic. After fighting with various options and nearing the point of tearing my hair out, I looked at Netlify again and found a simple solution.

The code that runs gun8 is relatively simple (compiling Markdown files to HTML, with no database), but it's also custom built, which is fun to tinker with, but hinders its compatibility. My language of choice is Ruby, which immediately leads to Jekyll as a static site builder, but Jek's stubborn unwillingness to work with Haml and my inability to make it even apply a layout to a page made me frustrated and hesitant to convert my site to match its hard-coded expectations.

Going static

After digging around for possible solutions and finding out that I'd written about how to make static sites in 2013 😳, I gave Netlify another look, convincing myself to ignore their focus on single-page Javascript sites. As someone who browses the web with Javascript turned off, I despise sites that are unable to display photos and text without enabling Javascript, so I was hesitant to try Netlify, which seemed focused on Node/JS frameworks. Somehow I stumbled upon their drag-and-drop uploader, and dragged my folder of static files onto there (that I'd built by wget --mirroring my local development site πŸ₯΄), and bonk there was a mostly-functioning site! No fighting with Content-Types on Amazon S3 or dancing with the Jekyll gods to get the site compiled.

Pretty URLs

The frustrating aspect of any static site is trying to get pretty URLs that don't end in .html. That's a complicated endeavor on S3 or Github Pages, but it's easy to solve on Netlify by… clicking the "pretty URLs" button 😁. Add -E to your wget to give your static files an .html extension and wham-o you have pretty URLs without any weird renamed directories and hundreds of "index.html" files.

Netlify magically rewrites all URLs sitewide to correctly point to the right location (unlike Cloudfront's mirroring setup) and navigates redirecting ending-slash-or-no-slash to make one canonical URL for each pretty URL'd page, two benefits that I am more than happy to outsource to someone else's mind ☺️.

Make a change

Deploying and updating are as simple as dragging the static site folder into your Netlify admin area. I've tested out a few simple changes and they propagate faster than when I've used Amazon S3/Cloudfront or Github Pages. Plus it's extremely satisfying to feel like Netlify is working with you instead of against you. I've been programming Ruby for more than a decade and it's downright demoralizing to fight with Ruby-based Jekyll only to end up with unstyled page fragments. Netlify provides thought-out solutions instead of dead ends. Compiling locally means that the extra processing steps I would have been giving up to run Jekyll (like adding Twitter meta tags) can be easily solved however I want locally before the HTML is uploaded.

The site still goes through Cloudflare, and gun8 was basically a static site before, so any actual speed increase after switching to Netlify would be difficult to notice.


Still, it's a bit silly that there's not a web host where a bunch of Markdown or HTML files can be plopped down and turned into a website. Maybe that's the domain of Wix-style website builders or maybe anyone who wants to create a website is expected to maintain a Wordpress installation, but at some point it should be as easy to post text on "text hosts" just like you can post photos on image hosting sites, then pass around the link. Generally the "simple" web builders are wacky Javascript templates that community groups and small businesses get looped into using after a quick web search, and I end up wrestling with the resulting sites when trying to find info for pages like AGBC's list of annual Halloween events.

Thankfully there are sites like Neocities that still allow emerging web devs to play with HTML, and anyone could silo their writing away into or Telegram's or shudder as a Facebook post.

or just bring back, where I got my start writing poetry sometime around 2001 πŸ˜›