Sunday, February 25, 2024
This blog needs a decent search feature. I've tried adding custom Google or DuckDuckGo searches but that's not a great experience. I think I'll try generating an index out of Tinderbox and use something like fuse.js for search. It should be terribly difficult, but it's just that I don't feel like doing it right now. Having to roll my own site search is one of the drawbacks of using a "non-standard" tool for blogging. For now, visit the Archives page and just use CMD/CTRL-f I guess. That's what I do.
Update, 2 hours later: Adding search to Jack Baty Daily.
More than enough camera
I have been carrying the little Ricoh GRII with me everywhere lately instead of the Leica Q2 or even the MP. I think the images from the GRIII are great, and the camera fits in my pocket.
The story might be different if I said, "Wow! These are so much better!" when looking at files from the Q2, but I never say that. The GRIII images are more than good enough for the kind of photos I make. This is difficult for me to admit.
So this is what got me thinking about the new Fujifilm X100VI. I tend to dismiss "cropped" sensors but given my realization about the GRIII, maybe I'm over it. The problem I have with a crop sensor is that the lenses aren't the "proper" focal length. I know it's stupid, but it bugs me. But, with the X100VI, the lens is permanent, so I never have to think about what the lens says vs what the image shows. It's around 35mm and that's it.
I'm sure the X100VI will be more than enough camera. It's a third of the price, half the size, and just as good at the things that are beginning to matter to me. I'll miss the incredible build quality and ease of operation of the Q2, but I'll get over it. I hope.
Is using Markdown worth it here?
Tinderbox notes are rich text, but can pretend to be Markdown if pressed. Since I prefer Markdown everywhere but in Emacs, I’m considering a switch to Markdown templates for new posts here (You’re soaking in it). Cool, right? My concern is that it will slow down rendering, eventually. I guess we’ll see. The other thing I think about is whether using Markdown in Tinderbox is swimming upstream. It’s a long way from the default way of doing things, which in my experience tends to introduce weird little bugs. Again, we’ll see. As a test, here’s a (markdown) link to an earlier post: Markdown in Tinderbox.
Update: I don’t think it’s worth it. I can’t use built-in linking features of Tinderbox. I don’t see inbound/outbound links. I was right, it feels like swimming upstream. Maybe I will cherry-pick certain posts as Markdown (easily done by simply choosing the “markdown” prototype for the note”).
Adding search to Jack Baty Daily
After lamenting this morning that I didn't feel like figuring out how to add search to this blog, I've added search to this blog. Here's a short summary of what I did.
First, I used most of the UI and Fuse.js work from this post by Yihui Xie. (Thanks!)
To generate the index.json file, I created a page and new template in Tinderbox. The export inspector for the index generator looks like this:
Note the export file name and extension is set so that the output file is "index.json"
The parent template is simply a JSON array wrapper:
Each child is then rendered using the "search index item" template:
Note that that final if statement is necessary so that we don't end up with an extra comma after the last item which would make the JSON invalid. (This is one reason I don't like working with JSON. Can't it forgive me that last comma? You know what I meant!
Anyway, the search page loads fuse.js and includes some JavaScript to handle the search (also thanks to Yihui Xie, see his post for details.)
Rendering the index.json file is a little time consuming, so I'll do that manually every once in a while. This means the search won't always include everything but we can live with that.
The search results aren't pretty due to the raw HTML that is rendered, but it's good enough for now. I don't know why Tinderbox escapes everything multiple times when calling "jsonEncode()" but if you know why please let me know.
Try it and let me know if it works! Search