scttwillsey

Media Reviews Are Now in Search Results

When I added a Reviews page, I wanted to be able to have individual reviews show up in my site search. Due to some complexities I won’t go into of how Pagefind indexes things and how I optimize my images using the Astro Image component, this was easier said than done – until I remembered the good old HTML hidden global attribute. Then I just made a hidden span and populated it with the image alt text.

<div class="review">
      <p>
        {
          page.data.map((book) => (
            <span hidden>{`${book.alttext}`}</span>
            <a href={`/images/posts/${book.review}.jpg`}>
              <Image
                src={import(`../../../assets/images/posts/${book.review}.png`)}
                alt={`${book.alttext}`}
              />
            </a>
          ))
        }
      </p>
    </div>

Now all my media reviews show up in site seach results!

SearchReviewsResults

Enjoy the reviews, and don’t forget there are separate categories for Book Reviews, Movie Reviews, TV Show Reviews, and Music Reviews. I will be actively adding more reviews from this point forward.

Latest Posts

Browse all posts
  1. MikanMessage — a Display Message Action for Apple Shortcuts

    Introducing MikanMessage — A Display Message action for Apple Shortcuts

  2. The Great npm Purge of 2026

    No more node_modules: moving my sites from Astro to Zola, and letting Claude do the heavy lifting.

  3. No, I Am Not AI

    Some people on Hacker News think I am an AI