TLDR Web Dev · ARTICLES & TUTORIALS
NO SERVER, NO DATABASE: SMARTER RELATED POSTS IN ASTRO WITH `TRANSFORMERS.JS`
Summary from the TLDR Web Dev newsletter
This article goes over how to implement smarter related-post suggestions for an Astro blog using Hugging Face's transformers.js, without needing servers or databases. It uses embeddings, which capture the meaning of text using numeric vectors, and cosine similarity to find posts with similar content. The entire workflow is shown: loading markdown files, generating embeddings with transformers.js, calculating similarities, and displaying the top related posts.