Conversation
|
🌐 Fork Preview for PR #550 https://pr-550.ddev-com-fork-previews.pages.dev This preview updates automatically when you push changes to your fork. |
|
Could search results be in descending modified date? |
72bac98 to
94509c3
Compare
I added support for modified date, but note that the search will still prefer blog titles (so it won't always be descending modified date). |
|
That's because the word "windows" appeared much more often in the first blog post. I pushed another change, should be better now. |
rfay
left a comment
There was a problem hiding this comment.
Thanks! It definitely behaves the way I'd expect now.
When you get interested in it again, it would be useful to show both pubDate and modifiedDate in the search results.
…ritization ## The Issue The site search was too strict, requiring exact matches. Search results didn't show publication dates, making it difficult to assess content recency. Blog posts lacked article:published_time OpenGraph metadata for SEO. Category/author index pages were incorrectly labeled as "Blog Post" in results. ## How This PR Solves The Issue **Search improvements:** - Add fuzzy matching (0.2 tolerance) for typo forgiveness - Add prefix matching for partial term searches - Display publication dates for blog posts (format: "Month DD, YYYY") - Prioritize blog posts over other pages in search results - Sort by: blog posts first → relevance score → date (tiebreaker) - Boost title matches 2x for better relevance - Extract isBlogPost helper to eliminate duplicate logic - Fix category/author pages incorrectly labeled as "Blog Post" **Metadata enhancements:** - Add article:published_time OpenGraph metadata to blog post pages - Store publication dates in search index via article:published_time extraction - Pass pubDate prop through Layout component **Code quality:** - Simplify search result detection with reusable isBlogPost function - Clean three-tier sorting: content type → relevance → recency ## Manual Testing 1. Search with typos (e.g., "ddevv") - fuzzy matching finds "ddev" 2. Search partial terms (e.g., "dock") - prefix matching finds "docker" 3. Verify blog posts appear before pages in mixed results 4. Check search results show dates for blog posts only 5. Verify `<meta property="article:published_time">` in blog post HTML 6. Rebuild and verify search.json includes date field ## Automated Tests No automated tests added. Changes affect: - Client-side search (src/pages/search.astro) - Search index generation (src/lib/search-index.js) - OpenGraph metadata (src/layouts/Layout.astro) ## Release Notes **Minor version bump** - New features added (fuzzy search, date display, metadata) 🤖 Developed with assistance from [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
a4f134a to
59be544
Compare
Good idea, done. |
|
So great! |
|
PR closed. The Cloudflare Pages preview is no longer updated. |

The Issue
The site search was too strict, requiring exact matches. Search results didn't show publication dates, making it difficult to assess content recency. Blog posts lacked article:published_time OpenGraph metadata for SEO. Category/author index pages were incorrectly labeled as "Blog Post" in results.
How This PR Solves The Issue
Search improvements:
Metadata enhancements:
Code quality:
Manual Testing
https://pr-550.ddev-com-fork-previews.pages.dev/search/
<meta property="article:published_time">in blog post HTML