aboutsummaryrefslogtreecommitdiff
path: root/build/1kb/index.html
diff options
context:
space:
mode:
authorBradley Taunt <bt@btxx.org>2024-06-06 08:05:12 -0400
committerBradley Taunt <bt@btxx.org>2024-06-06 08:05:12 -0400
commit6b742c459266b18e2b375b35205ce8a6c02f0452 (patch)
treeb16fbb9a045e33dd6c97eb5ab72e6ff4d9237ea3 /build/1kb/index.html
Initial commit
Diffstat (limited to 'build/1kb/index.html')
-rw-r--r--build/1kb/index.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/build/1kb/index.html b/build/1kb/index.html
new file mode 100644
index 0000000..36b7f7a
--- /dev/null
+++ b/build/1kb/index.html
@@ -0,0 +1,72 @@
+<!doctype html>
+<html lang="en" id="top">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="data:,">
+ <title>Making a Website Under 1kB</title>
+ <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
+ <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
+</head>
+
+<nav>
+ <a href="#menu">Menu &darr;</a>
+</nav>
+
+<main>
+<h1>Making a Website Under 1kB</h1>
+<p>2022-08-02</p>
+<p>I recently launched (another) website club called the <a href="https://1kb.club">1kB Club</a>. Unlike the <a href="https://1mb.club">1MB Club</a>, it isn't as accessible for most modern websites to become official members. Building a website that actually serves useful content while squeezing its page size under 1,024 bytes is no easy feat.</p>
+<p>But it is possible. And I did it myself!</p>
+<p><em>Note:</em> Big shout-out to <a href="https://t0.vc">Tanner</a>, who inspired this whole "movement" with his own minimal website. (He also has some really great creations/articles there too!)</p>
+<h2>The HTML</h2>
+<p>For reference, you can view my "mini" website here: <a href="https://cv.tdarb.org">cv.tdarb.org</a>. It is <em>very</em> minimal and serves only as a personal curriculum vitae. It also weighs only <strong>920 bytes</strong> and is valid HTML.</p>
+<p>Let's take a look at the full HTML and then break things down from there:</p>
+<pre><code>&lt;!DOCTYPE html&gt;&lt;link rel=&quot;icon&quot; href=&quot;data:,&quot;&gt;&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1.0&quot;&gt;&lt;title&gt;CV&lt;/title&gt;&lt;p&gt;Hi, I'm &lt;a href=&quot;t&quot;&gt;Brad Taunt&lt;/a&gt;! I'm a UX designer.&lt;p&gt;Email: hello@tdarb.org&lt;p&gt;Resume&lt;p&gt;Senior Product Designer @ Donorbox, 2021-&lt;br&gt;Web Designer @ Purism, 2019-2021&lt;br&gt;Product Designer @ Benbria, 2013-2019&lt;br&gt;Web Designer @ Netvatise, 2009-2013&lt;p&gt;Projects&lt;p&gt;&lt;a href=&quot;1&quot;&gt;1MB Club&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;k&quot;&gt;1kB Club&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;p&quot;&gt;pblog&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;s&quot;&gt;shinobi&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;h&quot;&gt;PHPetite&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;v&quot;&gt;Vanilla CSS&lt;/a&gt;&lt;p&gt;Writing&lt;p&gt;&lt;a href=&quot;d&quot;&gt;The Death of Personality&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;u&quot;&gt;Simple Does Not Mean Ugly&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;e&quot;&gt;Plain Text Emails, Please&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;tb&quot;&gt;[more]&lt;/a&gt;
+</code></pre>
+<h2>Sneaky "Hacks"</h2>
+<p>The first thing you'll notice is that the HTML is compressed. White space adds extra bytes of data to the page weight - so it needs to go. Next, you might have caught the <em>odd</em> favicon meta tag:</p>
+<pre><code>&lt;link rel=&quot;icon&quot; href=&quot;data:,&quot;&gt;
+</code></pre>
+<p>This is required to stop the browser from making the standard favicon request (normally pulling from <code>favicon.ico</code>). By adding this meta tag you are telling the browser to load in an empty image without running another server request. This saves about 400 bytes of bandwidth on its own!</p>
+<p>The next two meta tags after the <code>icon</code> are technically optional. These are the <code>viewport</code> and <code>title</code> tags. You could save a good amount of data by excluding them altogether, but I had my own personal reasons for keeping them:</p>
+<ol>
+<li>I wanted the web page to be responsive</li>
+<li>I wanted the page to be <a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fcv.tdarb.org%2F">valid HTML</a></li>
+</ol>
+<p>So, I kept these tags but made them as minimal as I possibly could (looking at you <code>title</code> tag). After that, it was time to add my content!</p>
+<h2>Where We're Going, We Don't Need Tags...</h2>
+<p>The beauty of using HTML5 is the ability to ditch "default" and closing tags on most elements. Think of all those bytes we can save!</p>
+<p>In the HTML above you will notice:</p>
+<ol>
+<li>There is no <code>html</code> element</li>
+<li>There is no <code>head</code> element</li>
+<li>There is no <code>body</code> element</li>
+<li>There are no closing <code>p</code> tags</li>
+</ol>
+<p>Even with all those "missing" elements, the webpage is still valid HTML5! Craziness.</p>
+<p>The final hack that saved a <em>ton</em> of bandwidth was implementing custom <code>href</code> URLs. Most of the links on the page take the user to another website altogether - which is fine. The problem is including these full domains inside the <code>a:href</code> tag. Those can start to eat up a lot of data.</p>
+<p>Luckily, I host this mini-site through Netlify so I can take full advantage of their optional <code>_redirects</code> file. Links are now set with a single character (ie. "1" for the 1MB Club link) and the <code>_redirects</code> file simply forwards the user to the custom domain. Pretty sneaky!</p>
+<h2>Closing Thoughts</h2>
+<p>This is a silly project that isn't meant to be taken so seriously. That being said, I'd love to see what other pages people are able to create while being limited to just 1kB.</p>
+<footer role="contentinfo">
+ <h2>Menu Navigation</h2>
+ <ul id="menu">
+ <li><a href="/">Home</a></li>
+ <li><a href="/projects">Projects</a></li>
+ <li><a href="/uses">Uses</a></li>
+ <li><a href="/wiki">Wiki</a></li>
+ <li><a href="/resume">Resume</a></li>
+ <li><a href="/colophon">Colophon</a></li>
+ <li><a href="/now">Now</a></li>
+ <li><a href="/donate">Donate</a></li>
+ <li><a href="/atom.xml">RSS</a></li>
+ <li><a href="#top">&uarr; Top of the page</a></li>
+ </ul>
+ <small>
+ Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
+ Maintained with ♥ for the web. <br>
+ Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
+ The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
+ </small>
+</footer> \ No newline at end of file