From b24001dae7bc0be091833e9b928876f9e23b0678 Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Thu, 4 Aug 2022 11:45:03 +0200 Subject: [PATCH] implementing searching in static websites --- content/notes/2022/08/03h08m44s51.md | 2 +- content/notes/2022/08/03h11m10s41.md | 10 +++ ...plementing-searching-in-static-websites.md | 78 +++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 content/notes/2022/08/03h11m10s41.md create mode 100644 content/post/2022/08/implementing-searching-in-static-websites.md diff --git a/content/notes/2022/08/03h08m44s51.md b/content/notes/2022/08/03h08m44s51.md index 14aefde4..abd62f79 100644 --- a/content/notes/2022/08/03h08m44s51.md +++ b/content/notes/2022/08/03h08m44s51.md @@ -3,7 +3,7 @@ date: 2022-08-03T08:44:51+02:00 context: "https://roytang.net/2022/08/twenty-years/" --- -Excellent summary Roy, cheers! I dug around in your archives and discovered you were into MtG [way back in 2001](https://roytang.net/archives/ancient/tripod/ffmagic/)---that's exactly the same year as I started playing! Since you regularly post updates on your digital Arene grinds, I was wondering how you migrated from analog to digital MtG. I only play with "the real stuff", but as a consequence, I regularly have trouble finding buddies to play with. +Excellent summary Roy, cheers! I dug around in your archives and discovered you were into MtG [way back in 2001](https://roytang.net/archives/ancient/tripod/ffmagic/)---that's exactly the same year as I started playing! Since you regularly post updates on your digital Arena grinds, I was wondering how you migrated from analog to digital MtG. I only play with "the real stuff", but as a consequence, I regularly have trouble finding buddies to play with. Since discovering Commander, I much prefer playing it like that: more chaos and politics, more crazy cards, and it's not always the player with the most expensive deck that wins. Most of my stuff is geared towards a budget anyway. diff --git a/content/notes/2022/08/03h11m10s41.md b/content/notes/2022/08/03h11m10s41.md new file mode 100644 index 00000000..98978add --- /dev/null +++ b/content/notes/2022/08/03h11m10s41.md @@ -0,0 +1,10 @@ +--- +date: 2022-08-03T11:10:41+02:00 +context: "https://fundor333.com/social/2022/08/03/1659516036/" +--- + +Fundor 333 asked: + +> In your opinion something like Gitea with a syndication like Mastodon will solve some of the problems and move more people on this “Gitea with Syndication”? + +I'd answer: yes and no. Yes, it will solve some problems---hopefully more easy collaboration across different instances. With GitHub, that's not a problem, provided that everyone uses GitHub. And No, I don't think it will move more people towards Gitea, since syndication and self-hosting are usually two "complicated" solutions. Note that I didn't say complex. Most people will still find it too troublesome to move. Just look at Mastodon VS Twitter. The `@user@mastodoninstance` thing already trips most people up. diff --git a/content/post/2022/08/implementing-searching-in-static-websites.md b/content/post/2022/08/implementing-searching-in-static-websites.md new file mode 100644 index 00000000..2bc3d8ee --- /dev/null +++ b/content/post/2022/08/implementing-searching-in-static-websites.md @@ -0,0 +1,78 @@ +--- +title: Implementing Searching In Static Websites +date: 2022-08-04T10:59:00+02:00 +categories: + - webdesign +tags: + - hugo + - searching +--- + +In my monthly [July 2022 overview](/post/2022/08/july-2022) write-up, I wrote: + +> This website got a new search engine! The baked archives page used to be powered by Lunr.js, which has been replaced by Pagefind.app. I guess this is worth its own blog post, I’ll save the details for later. + +It's time for those juicy details. + +Last month's first HugoConf revealed many interesting JAMStack-related tooling to boost your statically generated blog. For the uninitiated, a "JAMStack" is a _JavaScript, API, and Markup stack_ that (almost) enables static websites to be just as dynamic as true blogging engines such as Wordpress. For example, [a Webmention-based commenting system](/post/2021/05/beyond-webmention-io/) with a queryable API, a few pre- and post-processor scripts like [YouTube link to image converters](/post/2021/06/youtube-play-image-links-in-hugo/), or, **search functionality**. + +One of those new search tools mentioned during the conference is [Pagefind](https://pagefind.app/). Since I was looking into throwing out [Lunr.js](https://lunrjs.com/) anyway, it was a good opportunity to try out new things. The result is the simple but very fast [search bar in the /archives page](/archives). + +How do these tools work? + +1. You generate some content in Markdown. Your static site processor, in my case Hugo, converts it to static HTML, ready to be served to visitors. +2. A script needs to be run to create **an index** of your content---either by processing the `.md` source, or the `.html` target. The result is usually a fairly large `.js` file. +3. On a search page, you include 2 `