From bc7aba4ed7b51f1cdb1394a11547dd26717a1635 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Mar 2026 15:20:23 +0000 Subject: [PATCH] Fix search dialog not labelling research papers correctly Research papers at /policy/research/ were falling through to the generic "page" content type in getContentType(), making them indistinguishable from static pages. Adds a "research" type with a ScrollText icon, updates the search placeholder to mention research, and documents the content type badges in docs/search.md. https://claude.ai/code/session_019NBUVE1vwCdDoYLE64gDzs --- docs/search.md | 1 + src/components/react/search-dialog.tsx | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/search.md b/docs/search.md index dcad0851..15367120 100644 --- a/docs/search.md +++ b/docs/search.md @@ -36,6 +36,7 @@ Chrome elements (navbar, footer, CTA banner, newsletter signup) have `data-pagef - **Multi-word queries** default to phrase search (wrapped in quotes); falls back to OR search if no phrase results - **Single-word queries** use standard search - Results show title, content type badge, and highlighted excerpt +- Content type badges: `article` (articles), `story` (member stories), `research` (policy & research papers), `page` (everything else) ## Testing Locally diff --git a/src/components/react/search-dialog.tsx b/src/components/react/search-dialog.tsx index 02bda92a..32274b6e 100644 --- a/src/components/react/search-dialog.tsx +++ b/src/components/react/search-dialog.tsx @@ -5,6 +5,7 @@ import { FileText, BookOpen, Newspaper, + ScrollText, Loader2, } from "lucide-react"; import { useState, useEffect, useRef, useCallback } from "react"; @@ -35,12 +36,14 @@ interface PagefindAPI { const contentTypeIcons: Record = { article: Newspaper, story: BookOpen, + research: ScrollText, page: FileText, }; function getContentType(url: string): string { if (url.startsWith("/articles/")) return "article"; if (url.startsWith("/stories/")) return "story"; + if (url.startsWith("/policy/research/")) return "research"; return "page"; } @@ -174,7 +177,7 @@ export default function SearchDialog() { setQuery(e.target.value)} className="flex-1 bg-transparent text-base text-primary-dark outline-none placeholder:text-gray-dark" @@ -266,7 +269,7 @@ export default function SearchDialog() { Search - Search articles, stories, and pages on the Green Software Foundation + Search articles, research, stories, and pages on the Green Software Foundation website.