alunduil / alunduil/blog.alunduil.com

Weight Pagefind search results by read count

Open
#145 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Astro
Stars
1
Forks
1
Avg merge
6h 34m
Merged PRs (30d)
118

Description

## Goal

When two posts match a query about equally on text relevance, prefer the one more readers have engaged with. Small extension on top of Pagefind (already shipped with AstroPaper).

## Implementation sketch

- Pagefind supports custom [sort](https://pagefind.app/docs/sorts/) and [filter](https://pagefind.app/docs/filtering/) attributes via \`data-pagefind-sort\` HTML attributes.
- At build time, after generating read-count JSON (#142), inject \`data-pagefind-sort=\"reads:\"\` on each post's wrapper element.
- Search UI exposes an optional \"sort by popularity\" toggle, or blends popularity into the default rank with a low weight.

## Why low priority

- Personal blog corpus is small; Pagefind's text relevance is already good enough most queries.
- Real value only kicks in once the corpus grows past ~50 posts.

## Depends on

- #141 (analytics source)
- #142 (per-post read-count data must already be baked into the build)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.