create-next-mdx-blog-app 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ This project was developed with the help of **Claude** (Anthropic) and **Cursor*
|
|
|
17
17
|
- [AI Features](#-ai-features)
|
|
18
18
|
- [Code Sandbox](#%EF%B8%8F-code-sandbox)
|
|
19
19
|
- [Author Profile Pages](#-author-profile-pages)
|
|
20
|
+
- [Search](#-search)
|
|
20
21
|
- [Newsletter Subscription](#-newsletter-subscription)
|
|
21
22
|
- [Supabase Database](#%EF%B8%8F-supabase-database)
|
|
22
23
|
- [Article Manager CLI](#%EF%B8%8F-article-manager-cli)
|
|
@@ -41,7 +42,7 @@ Scaffold the blog into an empty directory:
|
|
|
41
42
|
npx create-next-mdx-blog-app .
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
The installer ([`create-next-mdx-blog-app`](https://www.npmjs.com/package/create-next-mdx-blog-app/), v2.2.
|
|
45
|
+
The installer ([`create-next-mdx-blog-app`](https://www.npmjs.com/package/create-next-mdx-blog-app/), v2.2.3, MIT) clones the app, installs dependencies, and prints the environment setup steps.
|
|
45
46
|
|
|
46
47
|
### Option 2 — Manual clone
|
|
47
48
|
|
|
@@ -251,6 +252,29 @@ Components: `src/components/SandpackEditor.tsx` (provider, editor, toolbar, cons
|
|
|
251
252
|
|
|
252
253
|
A `/authors` index lists every distinct contributor pulled from the Supabase `Article` table, with per-author profile routes at `/authors/[slug]` showing their bio, avatar, and every article they've published.
|
|
253
254
|
|
|
255
|
+
## 🔍 Search
|
|
256
|
+
|
|
257
|
+
Full-text search across published articles at `/search`, powered by native Postgres `tsvector` — no external search service required.
|
|
258
|
+
|
|
259
|
+
- **Search-as-you-type** — `src/components/ArticleSearch.tsx` debounces input (300 ms), cancels stale requests with `AbortController`, caches repeated queries, and waits for at least 2 characters before querying
|
|
260
|
+
- **Prefix matching** — partial words match while you type (`reac` → `react`)
|
|
261
|
+
- **Ranked, weighted results** — scored by `ts_rank` with column weights (title > tags > description > content) and returned as lightweight summaries (the heavy `content` column is excluded)
|
|
262
|
+
- **Request flow** — `GET /api/search?q=…` (`src/app/api/search/route.ts`) → `searchArticles()` (`src/utils/functions/rpc/searchArticles.ts`) → the `search_articles` Postgres RPC
|
|
263
|
+
|
|
264
|
+
### One-time setup
|
|
265
|
+
|
|
266
|
+
Run **`scripts/sql/DDL/createSearchArticlesFunction.sql`** once in the Supabase SQL editor. It creates the weighted GIN index and the `search_articles` function. Search returns an error until this script is deployed.
|
|
267
|
+
|
|
268
|
+
### ⚠️ Change the hardcoded author filter
|
|
269
|
+
|
|
270
|
+
The shipped function locks results to a single author:
|
|
271
|
+
|
|
272
|
+
```sql
|
|
273
|
+
AND a."articleAuthorName" = 'Abdullah Muhammad.'
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Before deploying, replace `'Abdullah Muhammad.'` with **your own author name** — it must match the `articleAuthorName` values in your `Article` table **exactly**, including any trailing punctuation. Alternatively, **delete that line entirely** to search across all authors. Re-run the script after editing.
|
|
277
|
+
|
|
254
278
|
## 📬 Newsletter Subscription
|
|
255
279
|
|
|
256
280
|
An integrated newsletter signup form powered by [Resend](https://resend.com). Visitors can subscribe from the home page or the bottom of any article; new subscribers are added to a Resend **Audience** and receive a welcome email.
|
package/package.json
CHANGED