chugging away, no i am not splitting this into fine-grained commits

This commit is contained in:
2026-02-18 10:58:36 -08:00
parent e4342e764f
commit 42ce6ceb6f
25 changed files with 844 additions and 13 deletions

BIN
src/img/2026/cormorant.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -1,11 +1,14 @@
---
layout: base.njk
eleventyExcludeFromCollections: true
pagination:
data: collections.posts
size: 13
reverse: true
alias: postlist
eleventyNavigation:
key: home
order: 3
icon: fa fa-solid fa-crow
title: home
---
<h1>Home</h1>

8
src/pages/about.md Normal file
View File

@ -0,0 +1,8 @@
---
eleventyNavigation:
key: about
order: 4
title: about
icon: fa-regular fa-user
label: about Lee
---

3
src/pages/colophon.md Normal file
View File

@ -0,0 +1,3 @@
---
title: colophon
---

8
src/pages/contact.md Normal file
View File

@ -0,0 +1,8 @@
---
eleventyNavigation:
key: contact
order: 5
title: contact
icon: fa-solid fa-envelope-open-text
label: contact Lee
---

16
src/pages/gallery.njk Normal file
View File

@ -0,0 +1,16 @@
---
pagination:
data: collections["gallery"]
size: 13
reverse: true
alias: postlist
eleventyNavigation:
key: gallery
order: 2
title: gallery
icon: fa-regular fa-images
label: view the gallery
---
<p>the gallery page is for finished art</p>
{% include "postlist.njk" %}

View File

@ -0,0 +1,6 @@
export default {
permalink: function ({ title }) {
return `/${this.slugify(title)}/index.html`;
},
layout: "page.njk"
};

16
src/pages/reference.njk Normal file
View File

@ -0,0 +1,16 @@
---
pagination:
data: collections["reference"]
size: 13
reverse: true
alias: postlist
eleventyNavigation:
key: reference
order: 2
title: reference
icon: fa-regular fa-folder-open
label: read reference posts
---
<p>the reference page is for informational posts</p>
{% include "postlist.njk" %}

123
src/pages/style.md Normal file
View File

@ -0,0 +1,123 @@
---
title: style
---
Adaped from an introduction to Markdown in order to test and display styling of basic components of the site.
## Heading level 2
Since your title (defined in the front matter) is your heading level 1, you should never use another heading level 1 in your body.
### Heading level 3
The number of pound signs determines the heading level.
#### Heading level 4
It's also important not to skip heading levels. Don't jump from a 2 to a 4 or similar.
## Paragraphs
You'll notice that I am putting blank lines between headings and plain text. This is necessary, or they won't render correctly.
It's also important to put a blank line in between each paragraph. See what happens without it:
This is supposed to be a new paragraph, but it isn't.
### Inline styles
We can, of course, create **bold** and *italicized* text, or `inline monospace text`.
We can also create links, like this [link to the home page](/).
## Horizontal lines
Sometimes you want to insert a visual break in your text that isn't just a new paragraph. You can use three dashes to create a horizontal line:
---
This text will be below the line.
## Lists
### Unordered lists
Unordered lists can be created with dashes or asterisks. With dashes:
- this is an item
- this is another item
With asterisks:
* this is an item
* this is another item
### Ordered lists
Ordered (numbered) lists can be created with (surprise!) numbers. You can write numbers as you would normally, *or* you can just write the number 1 over and over, like so:
1. this is item 1
1. despite being written with a 1, this is item 2
This allows you to insert more information into lists in the future without having to renumber every following item.
### Nested lists
Both unordered and ordered lists can be nested. Just tab the nested section inwards:
- this is an item
- this is nested below it
- this is also nested
- this is another item
You can mix unordered and ordered lists when you nest.
## Quotes
You can always just use quotation marks, of course, but if you are quoting a larger chunk of text it can be nice to use a blockquote.
You format a blockquote by starting the line with a caret:
> This is a quote, and it will render differently than a paragraph.
If you want a quote to have multiple separate paragraphs, and still contiguously display as one quote, make sure to put a caret on the empty line between the paragraphs.
> This is a multi-paragraph quote.
>
> Here's the second paragraph.
>
> - Blockquotes can also have lists
> - They still have the caret at the front
## Monospace
You can write single words `in monospace`, or create code blocks:
```
3 backticks surround code blocks
```
Code blocks can have syntax highlighting:
```html
<h1>Hello, world</h1>
```
## Tables
Tables in Markdown are kind of annoying to format. You use the pipe (`|`) character as well as dashes.
```
| Header 1 | Header 2 |
|---|---|
| data 1a | data 1b |
| data 2a | data 2b |
| data 3a | data 3b |
```
When I remove the monospace block, you can see how this formats:
| Header 1 | Header 2 |
|---|---|
| data 1a | data 1b |
| data 2a | data 2b |
| data 3a | data 3b |

View File

@ -0,0 +1,137 @@
---
title: moving images
image:
src: 2026/cormorant.jpg
alt: "Image unrelated to post. A cormorant, a type of black waterfowl, poses with wings spread on a buoy in Puget Sound. Off to the left, another bird floats."
tags:
- reference
- software
---
## problem statement
today I decided to finally clean up the `assets/img` directory for this site. Since 2022, when I started this project, I've just been adding images directly to that directory with no further segmentation - messy of me, I know! It's gotten unwieldy and I'm starting to get worried about generic names leading to duplicates at some point, particularly for the non-gallery images where I have a tendency to [use](/stationery-exchange) [lots](/favorite-git-flag) [of](/trans-networks) [mushroom](/no-politics) [images](/domain-and-site-setup).
so it's time to move them into year-based folders. Let's talk about how I did that. `bash` away!
(want to [skip right to the completed script?](#result))
## find
let's start with the basics: a list of posts. `find` gets us everything under a specific directory - in this case, the `_posts` directory. We can filter out the directories a few different ways, but I piped the `find` output through a basic `grep` looking for `.md` in the filename.
```sh
for FILE in $(find _posts | grep .md)
do
# TBD
done
```
## grep
`grep` can also help us get image names with the regex `"name:.+jpg|png"`. I add `name:` to the regex because there are *very occasionally* images that aren't the featured image for the post, and those don't fit the pattern of `name: <img>`. Since there's so few of those, I ended up handling them manually.
to make `grep` work with regex, it needs the `-E` flag.
```sh
# gives us
# name: <img>
# note the 4 spaces at the beginning of the line
IMAGE_LINE=$(cat $FILE | grep -E "name:.+jpg|png$")
```
## cut
that output gets us the full line of text that includes the image filename. Let's trim out what we actually want.
below, `-d` sets a delimiter, and `-f` chooses what field we want to return. Because there's 4 spaces before `name`, our field index is actually pretty high - `cut` is creating 4 empty strings.
```sh
IMAGE=$(echo $IMAGE_LINE | cut -d ' ' -f 6 -)
```
or, for brevity:
```sh
IMAGE=$(cat $FILE | grep -E "name:.+jpg|png$" | cut -d ' ' -f 6 -)
```
with `cut`, we can also get the year of the post:
```sh
YEAR=$(echo $FILE | cut -d '/' -f 2 -)
```
## sed
there's two major things we need to do with the information we've gathered:
1. replace the image filename in-place in the post's markdown file
1. move the image file from its original location into a new directory
we can do replacement with `sed`, where our pattern should be something like this: `s/$IMAGE/$YEAR\/&\` (the `&` subs in the found string - in this case `$IMAGE`). We could also use comma separators if we don't want to escape the slash, like `s,$IMAGE,$YEAR/&,` - I did this for ease of reading.
by default, `sed` prints to standard output, so we'll tell it to edit in-place instead with `-i`. Here's our full `sed` command:
```sh
sed "s,$IMAGE,$YEAR/&," -i $FILE
```
## mving and shaking
(my mom thinks I'm funny.)
now we'll handle moving the image file from its original location into a new directory. let's create our image paths, source and destination:
```sh
IMG_DIR=assets/img
NEW_IMAGE=$IMG_DIR/$YEAR/$IMAGE
IMAGE=$IMG_DIR/$IMAGE
```
trying to `mv` the images will immediately cause problems, because the year directories don't exist yet. A simple check gets us past that:
```sh
if [ ! -d $IMG_DIR/$YEAR ]
then
mkdir $IMG_DIR/$YEAR
fi
```
finally, we can `mv` the image:
```sh
mv $IMAGE $NEW_IMAGE
```
## result
here's our final script:
```sh
for FILE in $(find _posts | grep .md)
do
# parse image and year info
IMAGE=$(cat $FILE | grep -E "name:.+jpg|png$" | cut -d ' ' -f 6 -)
YEAR=$(echo $FILE | cut -d '/' -f 2 -)
# replace in-place in file
sed "s,$IMAGE,$YEAR/&," -i $FILE
# path creation
IMG_DIR=assets/img
NEW_IMAGE=$IMG_DIR/$YEAR/$IMAGE
IMAGE=$IMG_DIR/$IMAGE
# create dir for year if it doesn't exist
if [ ! -d $IMG_DIR/$YEAR ]
then
mkdir $IMG_DIR/$YEAR
fi
# move image
mv $IMAGE $NEW_IMAGE
done
```
questions? errors? [ping me!](/contact)

View File

@ -2,7 +2,7 @@
title: Sample
date: 2026-02-17
tags:
- test
- gallery
image:
src: 2026/sample-0.jpg
alt: filler

View File

@ -5,5 +5,5 @@ export default {
tags: [
"posts"
],
layout: "base.njk"
layout: "post.njk"
};

3
src/src.11tydata.js Normal file
View File

@ -0,0 +1,3 @@
export default {
layout: "base.njk"
};