From 41420c0e32cba69d4f4e19175bd3350fed427275 Mon Sep 17 00:00:00 2001
From: Prefetch
Date: Sun, 20 Nov 2022 11:36:46 +0100
Subject: Publish "Website adventures" part 2 about HTML and CSS
---
 .../blog/2022/website-adventures-basics/index.md   | 356 +++++++++++++++++++++
 .../2022/website-adventures-generators/index.md    |  27 +-
 2 files changed, 376 insertions(+), 7 deletions(-)
 create mode 100644 source/blog/2022/website-adventures-basics/index.md
(limited to 'source/blog/2022')
diff --git a/source/blog/2022/website-adventures-basics/index.md b/source/blog/2022/website-adventures-basics/index.md
new file mode 100644
index 0000000..31e0fc3
--- /dev/null
+++ b/source/blog/2022/website-adventures-basics/index.md
@@ -0,0 +1,356 @@
+---
+title: "Adventures in making this website:
` tag.
+
+Sure, we could have some philosophical debates about HTML's design decisions.
+Why is there a distinction between `
` and ``?
+What's the point of some of [HTML5](https://en.wikipedia.org/wiki/HTML5)'s
+new semantic tags if I can just replace them with ``s?
+Don't the new media elements (e.g. `
`)
+maybe control the browser's behaviour a bit *too* explicitly?
+And whose idea was [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee) anyway?
+But overall it holds up pretty well to scrutiny.
+
+I've heard people suggest that instead of XML,
+HTML should've used [S-expressions](https://en.wikipedia.org/wiki/S-expression).
+Yes, I wish we lived in a world where HTML and JS were both replaced by a single Lisp!
+That would be wonderful, but unfortunately *this* is the world we live in;
+the sooner we accept it, the better.
+And if I'm honest, I like how XML shows me the element name in the closing tag)))))).
+
+
+
+## The bad: CSS
+
+CSS, on the other hand, is a pain.
+I want the following statement on my gravestone:
+*"At least 33% of the CSS you write is for fixing the unexpected behaviour of the other 67%"*.
+I came up with this rule of thumb a few years ago, and I don't think it's failed me yet,
+although note that I include code churn under "writing CSS".
+My site's [`main.css`](/code/prefetch-jekyll/tree/source/infra/css/main.css)
+is quite simple, but I've obsessed over it for many hours,
+trying to trim all the fat without breaking anything.
+
+Although CSS is well-standardized,
+browser compatibility appears to be a surprisingly big issue.
+This why we have projects like
+[`normalize.css`](https://github.com/necolas/normalize.css),
+[`destyle.css`](https://github.com/nicolas-cusan/destyle.css),
+and [`reseter.css`](https://github.com/resetercss/reseter.css),
+which I learned about later than I should have.
+See the vertical line under this page's header?
+You wouldn't believe how many times its location surprised me
+while testing different browsers and devices.
+Sure, you can argue that using an `` and `` elements.
+Great, no JS required!
+These tags were only recently added to HTML,
+so (can you see where this is going?) they're [unsupported in IE](https://caniuse.com/details).
+A demonstration:
+
+
+Click me, I dare you 
+Here we can bully IE users, because they can't close this `<details>` box:
+IE is old and slow, and its users are even older and slower,
+and they're also smelly! Take that! 
+ 
+
+So... time for JS? Well, fortunately, there's another way,
+using just old-school HTML and CSS:
+
+
+
+
Click to show (IE welcome too) 
+
+Click to hide. 
+This is a safe space where users of all browsers can rejoice together in peace. 
+
+
`, `
` and `
`:
+```html
+{% raw %}
+
+
+
+
+
Click to show 
+
+
+
+Click to hide {% endraw %}
+
+...
+
+
` is immediately followed by `` in the HTML document,
+then apply this rule to the `` element":
+```css
+/* Hide the content by default */
+.collapsible-hidden {display: none;}
+/* Make the checkbox invisible */
+input.collapsible {display: none;}
+/* If it's checked, then show the content... */
+input.collapsible:checked + label + .collapsible-hidden {display: block;}
+/* ... and hide the original text label */
+input.collapsible:checked + label {display: none;}
+```
+
+Compared to ``, this even gives some extra flexibility.
+For an example of a page using this technique,
+click [here](/know/concept/boltzmann-equation/) and scroll down.
+
diff --git a/source/blog/2022/website-adventures-generators/index.md b/source/blog/2022/website-adventures-generators/index.md
index 0aba183..7e52f17 100644
--- a/source/blog/2022/website-adventures-generators/index.md
+++ b/source/blog/2022/website-adventures-generators/index.md
@@ -5,11 +5,14 @@ layout: "blog"
 toc: true
 ---
 
+Published on 2022-11-15, last updated on 2022-11-20.
+
 Making and managing this personal website has been an adventure.
 In this series, I go over the technical challenges I've encountered
 and philosophical decisions I've made,
 and I review some of the tools I've used along the way.
-This is part 1, with more posts coming soon.
+This is part 1, followed by [part 2](/blog/2022/website-adventures-basics/),
+with more coming.
 
 
 
@@ -201,14 +204,17 @@ after a few small tweaks like adding a navigation bar at the top of the page:
 ```
 
 On the one hand, Hugo provides the convenient `.TableOfContents` variable
-at the cost of control, unlike Zola, where we had to do it manually.
-On the other hand, Hugo doesn't use block-based templates
-and hence lacks a nice inheritance system like Zola's.
-If you want to reuse a snippet, you put it in a file e.g. `navbar.html`
+at the cost of control, unlike Zola, where we had to do it
+manually. ~~On the other hand, Hugo doesn't use block-based templates
+and hence lacks a nice inheritance system like Zola's~~
+[I stand corrected](https://lobste.rs/s/x2bknz/adventures_making_my_website_static_site#c_jbmpl2),
+Hugo can do [Zola-style blocks](https://gohugo.io/templates/base/),
+but it's hard to figure this out on your own.
+If you want to reuse a snippet, you typically put it in a file e.g. `navbar.html`
 and include it as `{% raw %}{{ partial "navbar.html" . }}{% endraw %}`.
 Note the dot at the end... I'll get to that.
-Overall, Hugo's approach to organizing templates feels "dumber" than Zola's,
-although, to be fair, my website had become a lot more complicated by then.
+Overall, Hugo's template organization feels "dumber" than Zola's,
+although my requirements had become a lot more complicated by then.
 
 Like most SSGs, Hugo uses an external template engine,
 namely the [`text/template`](https://pkg.go.dev/text/template) Go package.
@@ -472,3 +478,10 @@ Personally, compared to those two, I wouldn't recommend Hugo,
 but for some people (probably Go developers)
 it just might be what they're looking for.
 
+EDIT: There exists an SSG called [Soupault](https://soupault.app/)
+that has interesting alternative take on site generation.
+Its creator [pitched it to me](https://lobste.rs/s/x2bknz/adventures_making_my_website_static_site#c_cgemzs),
+and coincidentally its website includes [this comparison](https://soupault.app/tips-and-tricks/comparison)
+with the SSGs discussed in this article.
+Like I said, I don't intend to migrate again, like, *ever*,
+so I'm writing this to spread the word about an, in my opinion, intriguing project.
-- 
cgit v1.2.3