Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions src/components/react/search-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FileText,
BookOpen,
Newspaper,
ScrollText,
Loader2,
} from "lucide-react";
import { useState, useEffect, useRef, useCallback } from "react";
Expand Down Expand Up @@ -35,12 +36,14 @@ interface PagefindAPI {
const contentTypeIcons: Record<string, typeof FileText> = {
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";
}

Expand Down Expand Up @@ -174,7 +177,7 @@ export default function SearchDialog() {
<input
ref={inputRef}
type="text"
placeholder="Search articles, stories, and pages..."
placeholder="Search articles, research, stories, and more..."
value={query}
onChange={(e) => setQuery(e.target.value)}
className="flex-1 bg-transparent text-base text-primary-dark outline-none placeholder:text-gray-dark"
Expand Down Expand Up @@ -266,7 +269,7 @@ export default function SearchDialog() {

<Dialog.Title className="sr-only">Search</Dialog.Title>
<Dialog.Description className="sr-only">
Search articles, stories, and pages on the Green Software Foundation
Search articles, research, stories, and pages on the Green Software Foundation
website.
</Dialog.Description>
</Dialog.Content>
Expand Down
Loading