From 634301e45433bf06fcdae500d51275677e568adb Mon Sep 17 00:00:00 2001 From: Alexis Hovorka Date: Mon, 24 Oct 2022 22:14:06 -0600 Subject: Initial commit --- posts/20221024-static-site-generators.md | 82 ++++++++++++++++++++++++++++++ posts/20221031-ubiquitous-mundane-magic.md | 29 +++++++++++ posts/404.njk | 12 +++++ posts/feed.njk | 31 +++++++++++ posts/history.njk | 31 +++++++++++ posts/index.njk | 31 +++++++++++ posts/style.md | 81 +++++++++++++++++++++++++++++ posts/tags.njk | 27 ++++++++++ 8 files changed, 324 insertions(+) create mode 100644 posts/20221024-static-site-generators.md create mode 100644 posts/20221031-ubiquitous-mundane-magic.md create mode 100644 posts/404.njk create mode 100644 posts/feed.njk create mode 100644 posts/history.njk create mode 100644 posts/index.njk create mode 100644 posts/style.md create mode 100644 posts/tags.njk (limited to 'posts') diff --git a/posts/20221024-static-site-generators.md b/posts/20221024-static-site-generators.md new file mode 100644 index 0000000..a8a3740 --- /dev/null +++ b/posts/20221024-static-site-generators.md @@ -0,0 +1,82 @@ +--- +date: 2022-10-24 +title: Static Site Generators +--- + +So my current fascination is static site generators---programs that you can +feed, for example, a set of plain-text blog files, and have them rendered +into a folder full of "static" HTML files that can be deployed directly to a +webserver with no "moving parts." + +Websites made of static files are nice, both because those files are very easy +to cache for a significant speed up at load time, and because the number of +places security holes could be hiding is greatly reduced. This blog uses an SSG +called [Eleventy.js](https://www.11ty.dev/). + +## Why don't you just use \_\_\_\_\_\_? + +I didn't want to use a standard blog platform for a couple of reasons: first, +hosting it myself gives me ultimate control of the content I produce, forever. +I'm not interested in having someone else monetize my work with ads or +paywalls. I don't need the extra features those platforms would present to +me---I'm not worried about SEO or growing my readership; I have ADHD, and if +I'm honest with myself, I'm not sure this attempt at a blog will last any +longer than the previous ones. + +Second, I like making things myself, even when I'm kinda sorta reinventing the +wheel. It may take more time, but I always give familiar skills a good stretch, +and I almost always learn something new. I find the process kinda, like... +meditative, and fulfilling, and I *love* how what I produce at the end fits me +and my process like a glove. Being able to write in Markdown in vim and save my +entire site in a [self-hosted Git +repository](https://git.alexishovorka.com/blog.git/) feels extremely comfy to +me. + +And finally third, which is sort of a fusion of the previous two: doing it +myself lets me experiment much more easily. Adding a light/dark mode switch +like the one in the top right corner to a standard-issue blog template would +have taken me a lot more work. But since I designed this entire site from +scratch, it only took me a handful of lines of code that go right where I want +to put them. And all the little icons around the site---it was fun playing +around with CSS shapes again, instead of just slapping down SVGs or PNGs or +whatever. + +## My Setup + +The best description of my setup would be [the actual +code](https://git.alexishovorka.com/blog.git/) since it's bound to evolve at +least somewhat from anything I could write here. I'll go over some of the +trickier bits here though. + +The cleanest way I found to set a default page template in Eleventy.js was to +create a file at `globals/layout.js` which masks what would otherwise have been +generated by the system up to that point. At time of writing, it's pretty +short, just one line: + +```js +module.exports = "post.njk"; +``` + +`post.njk` is the layout template file for the page for an individual post. + +The same goes for the default page titles inside `globals/eleventyComputed.json`: + +```json +{ + {% raw %}"pageTitle": "{{ title | safe }} – {{ metadata.title | safe }}"{% endraw %} +} +``` + +Figuring out the most optimal way to set up the history pages took a little +doing. What I've settled on for now is putting them under `/archive/` with +`/archive/1/` being blurbs from the first five posts (once I've written that +many, of course). + +I haven't actually made the little heart-shaped "Like Post" button at the +bottom work yet, but the current plan is to make a little script that logs the +post's title to a text file and returns a 204, then when I want to get like +counts I can just do `sort likes.txt | uniq -c`. No funky injectable +databases---if there's spam, I can just delete the lines from the file and +maybe insert a little check to drop entries if there are any obvious patterns. + +That's it for now, I guess? See ya :wave: diff --git a/posts/20221031-ubiquitous-mundane-magic.md b/posts/20221031-ubiquitous-mundane-magic.md new file mode 100644 index 0000000..55d341a --- /dev/null +++ b/posts/20221031-ubiquitous-mundane-magic.md @@ -0,0 +1,29 @@ +--- +date: 2022-10-31 +title: Ubiquitous, Mundane Magic +--- + +I've been thinking again lately about how we live in a world with ubiquitous, +mundane magic. + + + +We harness lightning in intricate tiny structures made of sand and metal to +make them think, keeping their own internal time using perfectly beating hearts +made of crystals, sustaining themselves with energy sacs made of solid metallic +acid, communicating to other thinking structures using meshes of invisible +light all around us. + +We learn how to harness and direct the thoughts of these structures in +school-how to make them think more quickly, or more creatively, or more +aesthetically and approachably for those not familiar with the arcane, +inscrutable languages used to form those thought-directing spells. + +We carry opaque slabs of inorganic materials in our pockets, capable of near +instantaneous communication across the entire world, able to tell us our +precise positions on the planet with the aid of artificial stars we've placed +up in the sky with precisely manufactured atomic hearts that we've calibrated +to accommodate for the measurable difference in the speed of time between what +we experience on the ground and what they experience from their places in the +sky, not to mention any of the other hundreds, thousands, millions of things +the slabs can do. diff --git a/posts/404.njk b/posts/404.njk new file mode 100644 index 0000000..ad8f479 --- /dev/null +++ b/posts/404.njk @@ -0,0 +1,12 @@ +--- +layout: page.njk +permalink: 404.html +eleventyExcludeFromCollections: true +eleventyComputed: + pageTitle: 404 – {{ metadata.title | safe }} +--- + + +

404 Not Found

+

There isn't a page here.

+ Home diff --git a/posts/feed.njk b/posts/feed.njk new file mode 100644 index 0000000..1ad22fa --- /dev/null +++ b/posts/feed.njk @@ -0,0 +1,31 @@ +---json +{ + "permalink": "feed.xml", + "eleventyExcludeFromCollections": true, + "layout": "" +} +--- + + + {{ metadata.title }} + {{ metadata.subtitle }} + + + {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} + {{ metadata.url }} + + {{ metadata.author.name }} + + + {%- set latest_posts = collections.all | reverse -%} + {%- for post in latest_posts.slice(0,5) -%} + {%- set absolutePostUrl = post.url | url | absoluteUrl(metadata.url) %} + + {{ post.data.title }} + + {{ post.date | dateToRfc3339 }} + {{ absolutePostUrl }} + Read the full post online

]]>
+
+ {%- endfor %} +
diff --git a/posts/history.njk b/posts/history.njk new file mode 100644 index 0000000..76fbcd0 --- /dev/null +++ b/posts/history.njk @@ -0,0 +1,31 @@ +---js +{"layout": "page.njk", +"eleventyExcludeFromCollections": true, +"eleventyComputed": { + "pageTitle": "{{ pagination.pageNumber + 1 }} – {{ metadata.title | safe }}" }, +"permalink": "archive/{{ pagination.pageNumber + 1 }}/index.html", +"pagination": { + "data": "collections.all", + "before": data => data.slice(0,-1), + "alias": "posts", + "size": 5 }} +--- + +

{{ metadata.title }} — Page {{ pagination.pageNumber + 1 }}

+{% for post in posts %} +
+
+

{{ post.data.title }}

+ {{ post | excerpt | safe }} +
+{% endfor %} + diff --git a/posts/index.njk b/posts/index.njk new file mode 100644 index 0000000..f695075 --- /dev/null +++ b/posts/index.njk @@ -0,0 +1,31 @@ +---js +{"layout": "page.njk", +"permalink": "index.html", +"eleventyExcludeFromCollections": true, +"eleventyComputed": { + "metaDesc": "{{ metadata.subtitle }}", + "pageTitle": "{{ metadata.title | safe }}", + "previousPage": d => Math.ceil((d.collections.all.length-1)/5) }} +--- + +

{{ pageTitle }}

+
+ + {% set post = collections.all.slice(-1)[0] -%} +

{{ post.data.title }}

+ + {{ post.templateContent | fixAnchors(post.url) | safe }} + +{%- if post.data.tags %} +

{% for tag in post.data.tags %} + #{{ tag }}{% endfor %} +

+{% endif %} + +{%- if collections.all.length > 1 %} + +{% endif -%} diff --git a/posts/style.md b/posts/style.md new file mode 100644 index 0000000..8b3ef18 --- /dev/null +++ b/posts/style.md @@ -0,0 +1,81 @@ +--- +date: 2022-01-30 +eleventyExcludeFromCollections: true +title: Style Demo +heroImg: https://www.adorama.com/alc/wp-content/uploads/2018/11/landscape-photography-tips-yosemite-valley-feature.jpg +heroImgAlt: Landscape +tags: + - Elena-Brandt + - Bonnie-Brandt +--- + +Plain *italic* **bold** K ~~strike~~ ==redact== plain `code` plain +==`redacted code`== :wave: (c)(tm)(p)+- inserted + +==This is a redacted paragraph. Lorem ipsum dolor sit amet consectetur +adispicing elit.== + + + +Lorem Ipsum is simply dummy text of the printing and typesetting industry. +Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, +when an unknown printer Ctrl+C took a galley of type and +scrambled it to make a type specimen book. It has survived not only five +centuries, but also the leap into electronic typesetting, remaining essentially +unchanged. こりゃテストの文書です It was popularised in +the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, +and more recently with desktop publishing software like Aldus PageMaker +including versions of Lorem Ipsum. .ii .o'i mu xagji sofybakni +cu zvati le purdi + +

.ii .o'i mu xagji sofybakni cu zvati le purdi +kAtrInAs djEIn mAdjqYrIs +mi gle~ki~~ --- E1l2I3O4t wEIn wE,In +pErsEfOnIs

+ +## Subheading + +- List item +- Another with a lot of text in it so I can see what it looks like when it + wraps around + +1. Woot +1. Next number + +> And here's a block quote, but I'm not sure +> what to put in it to make it long enough. +> +> > Maybe if I nest? + + code block + indent + and back + + IDK if we'll use these much. + Maybe for computer terminal sessions? + + $ ls -a + . .. + +
+Collapsible Section + +Expandable details... + +Another paragraph +
+ +```js +function anotherCodeBlock() { + return this.timeWithSyntaxHighlighting(); +} +``` + +
+ +2103-02-02 13:34 Elena: There's also this transcript style, which I think is +reminiscent of IRC server logs. + +2103-01-01 13:35 Bonnie: Oooh, I like it! + +
diff --git a/posts/tags.njk b/posts/tags.njk new file mode 100644 index 0000000..cba0555 --- /dev/null +++ b/posts/tags.njk @@ -0,0 +1,27 @@ +--- +layout: page +eleventyExcludeFromCollections: true +pagination: + data: collections + size: 1 + alias: tag + filter: + - all + - posts +permalink: /{{ tag | slug }}/ +eleventyComputed: + title: "#{{ tag }}" + pageTitle: "{{ title }} – {{ metadata.title | safe }}" +--- + + +

{{ title }}

+
+{% set taglist = collections[ tag ] -%} +{% for post in taglist | reverse %} +
+

{{ post.data.title }}

+ {{ post | excerpt | safe }} +
+
+{% endfor -%} -- cgit v1.2.3-70-g09d2