diff --git a/AGENTS.md b/AGENTS.md index 09fba82..2c4c367 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,7 @@ Your content is instantly available to browsers, LLMs, and AI agents.. Write mar - **Total Posts**: 17 - **Total Pages**: 4 - **Latest Post**: 2025-12-29 -- **Last Updated**: 2026-01-04T04:52:17.079Z +- **Last Updated**: 2026-01-04T05:50:22.819Z ## Tech stack diff --git a/CLAUDE.md b/CLAUDE.md index 7017c26..66815f9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,7 +5,7 @@ Project instructions for Claude Code. ## Project context - + Markdown sync framework. Write markdown in `content/`, run sync commands, content appears instantly via Convex real-time database. Built for developers and AI agents. diff --git a/FORK_CONFIG.md b/FORK_CONFIG.md index 5360dca..8d5572c 100644 --- a/FORK_CONFIG.md +++ b/FORK_CONFIG.md @@ -49,20 +49,21 @@ The file `fork-config.json` is gitignored, so your configuration stays local and npm run configure ``` -This updates all 11 configuration files automatically: +This updates all 14 configuration files automatically: -- `src/config/siteConfig.ts` -- `src/pages/Home.tsx` -- `src/pages/Post.tsx` -- `convex/http.ts` -- `convex/rss.ts` -- `index.html` -- `public/llms.txt` -- `public/robots.txt` -- `public/openapi.yaml` -- `public/.well-known/ai-plugin.json` - -Theme is now configured in `src/config/siteConfig.ts` (via the `defaultTheme` field). +- `src/config/siteConfig.ts` (site name, bio, GitHub username, gitHubRepo config, default theme) +- `src/pages/Home.tsx` (intro paragraph, footer links) +- `src/pages/Post.tsx` (SITE_URL, SITE_NAME constants) +- `src/pages/DocsPage.tsx` (SITE_URL constant for CopyPageDropdown) +- `convex/http.ts` (SITE_URL, SITE_NAME constants) +- `convex/rss.ts` (SITE_URL, SITE_TITLE, SITE_DESCRIPTION) +- `netlify/edge-functions/mcp.ts` (SITE_URL, SITE_NAME, MCP_SERVER_NAME) +- `scripts/send-newsletter.ts` (default SITE_URL) +- `index.html` (meta tags, JSON-LD, page title) +- `public/llms.txt` (site info, GitHub link) +- `public/robots.txt` (sitemap URL) +- `public/openapi.yaml` (server URL, site name, example URLs) +- `public/.well-known/ai-plugin.json` (plugin metadata) ### Step 4: Review and deploy @@ -83,17 +84,19 @@ Edit each file individually following the guide below. | File | What to Update | | ----------------------------------- | ------------------------------------------------------------ | -| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, features | +| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, default theme, features | | `src/pages/Home.tsx` | Intro paragraph, footer links | | `src/pages/Post.tsx` | `SITE_URL`, `SITE_NAME` constants | +| `src/pages/DocsPage.tsx` | `SITE_URL` constant | | `convex/http.ts` | `SITE_URL`, `SITE_NAME` constants | | `convex/rss.ts` | `SITE_URL`, `SITE_TITLE`, `SITE_DESCRIPTION` | +| `netlify/edge-functions/mcp.ts` | `SITE_URL`, `SITE_NAME`, `MCP_SERVER_NAME` constants | +| `scripts/send-newsletter.ts` | Default `SITE_URL` constant | | `index.html` | Meta tags, JSON-LD, page title | | `public/llms.txt` | Site info, GitHub link | | `public/robots.txt` | Sitemap URL | -| `public/openapi.yaml` | Server URL, site name | +| `public/openapi.yaml` | Server URL, site name, example URLs | | `public/.well-known/ai-plugin.json` | Plugin metadata | -| `src/config/siteConfig.ts` | Default theme (`defaultTheme` field) | --- @@ -1234,16 +1237,19 @@ GitHub Repo Config (for AI service links): - Content Path: public/raw Update these files: -1. src/config/siteConfig.ts - site name, bio, GitHub username, gitHubRepo config +1. src/config/siteConfig.ts - site name, bio, GitHub username, gitHubRepo config, defaultTheme 2. src/pages/Home.tsx - intro paragraph and footer section with all creator links 3. src/pages/Post.tsx - SITE_URL and SITE_NAME constants -4. convex/http.ts - SITE_URL and SITE_NAME constants -5. convex/rss.ts - SITE_URL, SITE_TITLE, SITE_DESCRIPTION -6. index.html - all meta tags, JSON-LD, title -7. public/llms.txt - site info and GitHub link -8. public/robots.txt - header comment and sitemap URL -9. public/openapi.yaml - API title, server URL, contact URL -10. public/.well-known/ai-plugin.json - plugin metadata and contact email +4. src/pages/DocsPage.tsx - SITE_URL constant +5. convex/http.ts - SITE_URL and SITE_NAME constants +6. convex/rss.ts - SITE_URL, SITE_TITLE, SITE_DESCRIPTION +7. netlify/edge-functions/mcp.ts - SITE_URL, SITE_NAME, MCP_SERVER_NAME constants +8. scripts/send-newsletter.ts - default SITE_URL constant +9. index.html - all meta tags, JSON-LD, title +10. public/llms.txt - site info and GitHub link +11. public/robots.txt - header comment and sitemap URL +12. public/openapi.yaml - API title, server URL, contact URL, example URLs +13. public/.well-known/ai-plugin.json - plugin metadata and contact email ``` --- diff --git a/TASK.md b/TASK.md index f961ee4..0133790 100644 --- a/TASK.md +++ b/TASK.md @@ -4,10 +4,27 @@ ## Current Status -v2.8.4 ready. AI service links now use local /raw URLs with simplified prompt. +v2.8.6 ready. Fork configuration script now updates 14 files for complete site branding. ## Completed +- [x] Fork configuration improvements + - [x] Updated `scripts/configure-fork.ts` to update 3 additional files (DocsPage.tsx, mcp.ts, send-newsletter.ts) + - [x] Improved `updateOpenApiYaml()` to handle all example URLs in OpenAPI spec + - [x] Changed logoGallery hrefs from hardcoded markdown.fast URLs to relative URLs + - [x] Updated `FORK_CONFIG.md` with complete file list (14 files, was 11) + - [x] Updated `content/blog/fork-configuration-guide.md` with accurate file count + - [x] Added missing options to `fork-config.json.example` (statsPage, mcpServer, imageLightbox) + +- [x] Search result highlighting and scroll-to-match + - [x] Created `useSearchHighlighting.ts` hook with polling mechanism to wait for content load + - [x] Search query passed via `?q=` URL parameter for highlighting on destination page + - [x] All matching text highlighted with theme-appropriate colors (dark/light/tan/cloud) + - [x] First match scrolls into view centered in viewport with header offset + - [x] Highlights pulse on arrival, fade to subtle after 4 seconds + - [x] Press Escape to clear highlights + - [x] Updated SearchModal.tsx, BlogPost.tsx, Post.tsx, global.css + - [x] Update AI service links to use local /raw URLs - [x] Changed ChatGPT, Claude, Perplexity links from GitHub raw URLs to `/raw/{slug}.md` - [x] Simplified AI prompt to "Read this URL and summarize it:" diff --git a/changelog.md b/changelog.md index 8163a47..ed5440d 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,44 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [2.8.6] - 2026-01-04 + +### Changed + +- Fork configuration script now updates 14 files (was 11) + - Added `src/pages/DocsPage.tsx` (SITE_URL constant) + - Added `netlify/edge-functions/mcp.ts` (SITE_URL, SITE_NAME, MCP_SERVER_NAME) + - Added `scripts/send-newsletter.ts` (default SITE_URL) + - Improved `public/openapi.yaml` handling for all example URLs +- Logo gallery hrefs now use relative URLs instead of hardcoded markdown.fast URLs + - Links like `/how-to-use-firecrawl`, `/docs`, `/setup-guide` work on any forked site +- Updated `fork-config.json.example` with missing options (statsPage, mcpServer, imageLightbox) + +### Technical + +- Updated `scripts/configure-fork.ts` with new update functions: `updateDocsPageTsx()`, `updateMcpEdgeFunction()`, `updateSendNewsletter()` +- Updated `FORK_CONFIG.md` with complete file list and updated AI agent prompt +- Updated `content/blog/fork-configuration-guide.md` with accurate file count and output example + +## [2.8.5] - 2026-01-03 + +### Added + +- Search result highlighting and scroll-to-match feature + - Clicking a search result navigates to the exact match location (not just the heading) + - All matching text is highlighted with theme-appropriate colors + - Highlights pulse on arrival, then fade to subtle background after 4 seconds + - Press Escape to clear highlights + - Works across all four themes (dark, light, tan, cloud) + +### Technical + +- Created `src/hooks/useSearchHighlighting.ts` hook with polling mechanism to wait for content load +- Updated `src/components/SearchModal.tsx` to pass search query via `?q=` URL parameter +- Updated `src/components/BlogPost.tsx` with article ref for highlighting +- Updated `src/pages/Post.tsx` to defer scroll handling to highlighting hook when `?q=` present +- Added `.search-highlight` and `.search-highlight-active` CSS styles with theme-specific colors + ## [2.8.4] - 2026-01-03 ### Changed diff --git a/content/blog/fork-configuration-guide.md b/content/blog/fork-configuration-guide.md index 745fa19..ef0ec2d 100644 --- a/content/blog/fork-configuration-guide.md +++ b/content/blog/fork-configuration-guide.md @@ -68,7 +68,7 @@ Open `fork-config.json` and update the values: npm run configure ``` -The script reads your JSON file and updates all 11 configuration files automatically. You should see output like: +The script reads your JSON file and updates all 14 configuration files automatically. You should see output like: ``` Fork Configuration Script @@ -77,14 +77,16 @@ Reading config from fork-config.json... Updating src/config/siteConfig.ts... Updating src/pages/Home.tsx... Updating src/pages/Post.tsx... +Updating src/pages/DocsPage.tsx... Updating convex/http.ts... Updating convex/rss.ts... +Updating netlify/edge-functions/mcp.ts... +Updating scripts/send-newsletter.ts... Updating index.html... Updating public/llms.txt... Updating public/robots.txt... Updating public/openapi.yaml... Updating public/.well-known/ai-plugin.json... -Updating default theme in src/config/siteConfig.ts... Configuration complete! ``` @@ -103,17 +105,19 @@ The configuration script updates these files: | File | What changes | | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, features (logo gallery, GitHub contributions, visitor map, blog page, posts display, homepage, right sidebar, footer, social footer, AI chat, newsletter, contact form, newsletter admin, stats page, MCP server, dashboard, image lightbox) | +| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, default theme, features (logo gallery, GitHub contributions, visitor map, blog page, posts display, homepage, right sidebar, footer, social footer, AI chat, newsletter, contact form, newsletter admin, stats page, MCP server, dashboard, image lightbox) | | `src/pages/Home.tsx` | Intro paragraph, footer links | | `src/pages/Post.tsx` | SITE_URL, SITE_NAME constants | +| `src/pages/DocsPage.tsx` | SITE_URL constant | | `convex/http.ts` | SITE_URL, SITE_NAME constants | | `convex/rss.ts` | SITE_URL, SITE_TITLE, SITE_DESCRIPTION | +| `netlify/edge-functions/mcp.ts` | SITE_URL, SITE_NAME, MCP_SERVER_NAME constants | +| `scripts/send-newsletter.ts` | Default SITE_URL constant | | `index.html` | Meta tags, JSON-LD, page title | | `public/llms.txt` | Site info, GitHub link | | `public/robots.txt` | Sitemap URL | -| `public/openapi.yaml` | Server URL, site name | +| `public/openapi.yaml` | Server URL, site name, example URLs | | `public/.well-known/ai-plugin.json` | Plugin metadata | -| `src/config/siteConfig.ts` | Default theme (`defaultTheme` field) | ## Optional settings diff --git a/content/pages/changelog-page.md b/content/pages/changelog-page.md index a18ba0a..4ce3cd6 100644 --- a/content/pages/changelog-page.md +++ b/content/pages/changelog-page.md @@ -10,7 +10,42 @@ docsSectionOrder: 4 --- All notable changes to this project. -![](https://img.shields.io/badge/License-MIT-yellow.svg) + +## v2.8.6 + +Released January 4, 2026 + +**Fork configuration improvements** + +- Fork configuration script now updates 14 files (was 11) + - Added `src/pages/DocsPage.tsx` (SITE_URL constant) + - Added `netlify/edge-functions/mcp.ts` (SITE_URL, SITE_NAME, MCP_SERVER_NAME) + - Added `scripts/send-newsletter.ts` (default SITE_URL) + - Improved `public/openapi.yaml` handling for all example URLs +- Logo gallery hrefs now use relative URLs instead of hardcoded markdown.fast URLs +- Updated `fork-config.json.example` with missing options (statsPage, mcpServer, imageLightbox) + +Updated files: `scripts/configure-fork.ts`, `src/config/siteConfig.ts`, `FORK_CONFIG.md`, `content/blog/fork-configuration-guide.md`, `fork-config.json.example` + +## v2.8.5 + +Released January 3, 2026 + +**Search result highlighting and scroll-to-match** + +- Clicking a search result now navigates to the exact match location (not just the nearest heading) +- All matching text is highlighted with theme-appropriate colors +- Highlights pulse on arrival, then fade to subtle background after 4 seconds +- Press Escape to clear highlights +- Works across all four themes (dark, light, tan, cloud) + +**Technical details:** + +- New `useSearchHighlighting.ts` hook with polling mechanism to wait for content load +- Search query passed via `?q=` URL parameter instead of hash anchor +- Theme-specific highlight colors matching existing design system + +Updated files: `src/hooks/useSearchHighlighting.ts` (new), `src/components/SearchModal.tsx`, `src/components/BlogPost.tsx`, `src/pages/Post.tsx`, `src/styles/global.css` ## v2.8.4 diff --git a/files.md b/files.md index 093e937..90157bb 100644 --- a/files.md +++ b/files.md @@ -94,9 +94,10 @@ A brief description of each file in the codebase. ### Hooks (`src/hooks/`) -| File | Description | -| -------------------- | ------------------------------------------------ | -| `usePageTracking.ts` | Page view recording and active session heartbeat | +| File | Description | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `usePageTracking.ts` | Page view recording and active session heartbeat | +| `useSearchHighlighting.ts` | Search term highlighting and scroll-to-match. Reads `?q=` URL param, waits for content to load, highlights matches in DOM, scrolls to first match. | ### Styles (`src/styles/`) @@ -225,7 +226,7 @@ Markdown files for static pages like About, Projects, Contact, Changelog. | `sync-posts.ts` | Syncs markdown files to Convex at build time (markdown sync v2). Generates `raw/index.md` with home.md content at top, posts/pages list, and footer.md content at bottom | | `sync-discovery-files.ts` | Updates AGENTS.md, CLAUDE.md, and llms.txt with current app data | | `import-url.ts` | Imports external URLs as markdown posts (Firecrawl) | -| `configure-fork.ts` | Automated fork configuration (reads fork-config.json). ES module compatible using fileURLToPath for __dirname equivalent. | +| `configure-fork.ts` | Automated fork configuration (reads fork-config.json, updates 14 files). ES module compatible using fileURLToPath for __dirname equivalent. | | `send-newsletter.ts` | CLI tool for sending newsletter posts (npm run newsletter:send ). Calls scheduleSendPostNewsletter mutation directly. | | `send-newsletter-stats.ts` | CLI tool for sending weekly stats summary (npm run newsletter:send:stats). Calls scheduleSendStatsSummary mutation directly. | | `sync-server.ts` | Local HTTP server for executing sync commands from Dashboard UI. Runs on localhost:3001 with optional token authentication. Whitelisted commands only. Part of markdown sync v2. | diff --git a/fork-config.json.example b/fork-config.json.example index 52462bf..3a1a167 100644 --- a/fork-config.json.example +++ b/fork-config.json.example @@ -162,6 +162,20 @@ "dayOfWeek": 0, "subject": "Weekly Digest" }, + "statsPage": { + "enabled": true, + "showInNav": true + }, + "mcpServer": { + "enabled": true, + "endpoint": "/mcp", + "publicRateLimit": 50, + "authenticatedRateLimit": 1000, + "requireAuth": false + }, + "imageLightbox": { + "enabled": true + }, "dashboard": { "enabled": true, "requireAuth": false diff --git a/public/llms.txt b/public/llms.txt index cc6bf81..0942e7f 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -1,6 +1,6 @@ # llms.txt - Information for AI assistants and LLMs # Learn more: https://llmstxt.org/ -# Last updated: 2026-01-04T04:52:17.081Z +# Last updated: 2026-01-04T05:50:22.820Z > Your content is instantly available to browsers, LLMs, and AI agents. diff --git a/public/raw/changelog.md b/public/raw/changelog.md index e6dc885..b75e7fb 100644 --- a/public/raw/changelog.md +++ b/public/raw/changelog.md @@ -6,7 +6,43 @@ Date: 2026-01-04 --- All notable changes to this project. -![](https://img.shields.io/badge/License-MIT-yellow.svg) + +## v2.8.5 + +Released January 3, 2026 + +**Search result highlighting and scroll-to-match** + +- Clicking a search result now navigates to the exact match location (not just the nearest heading) +- All matching text is highlighted with theme-appropriate colors +- Highlights pulse on arrival, then fade to subtle background after 4 seconds +- Press Escape to clear highlights +- Works across all four themes (dark, light, tan, cloud) + +**Technical details:** + +- New `useSearchHighlighting.ts` hook with polling mechanism to wait for content load +- Search query passed via `?q=` URL parameter instead of hash anchor +- Theme-specific highlight colors matching existing design system + +Updated files: `src/hooks/useSearchHighlighting.ts` (new), `src/components/SearchModal.tsx`, `src/components/BlogPost.tsx`, `src/pages/Post.tsx`, `src/styles/global.css` + +## v2.8.4 + +Released January 3, 2026 + +**AI service links now use local /raw URLs** + +- ChatGPT, Claude, and Perplexity links now use local `/raw/{slug}.md` URLs instead of GitHub raw URLs +- Simplified AI prompt from multi-line instructions to "Read this URL and summarize it:" +- No longer requires git push for AI links to work (synced content available immediately) + +**Technical details:** + +- Updated URL construction to use `window.location.origin` for consistency +- Removed unused `siteConfig` import and `getGitHubRawUrl` function + +Updated files: `src/components/CopyPageDropdown.tsx` ## v2.8.3 diff --git a/public/raw/fork-configuration-guide.md b/public/raw/fork-configuration-guide.md index 7f55338..a33938b 100644 --- a/public/raw/fork-configuration-guide.md +++ b/public/raw/fork-configuration-guide.md @@ -58,7 +58,7 @@ Open `fork-config.json` and update the values: npm run configure ``` -The script reads your JSON file and updates all 11 configuration files automatically. You should see output like: +The script reads your JSON file and updates all 14 configuration files automatically. You should see output like: ``` Fork Configuration Script @@ -67,14 +67,16 @@ Reading config from fork-config.json... Updating src/config/siteConfig.ts... Updating src/pages/Home.tsx... Updating src/pages/Post.tsx... +Updating src/pages/DocsPage.tsx... Updating convex/http.ts... Updating convex/rss.ts... +Updating netlify/edge-functions/mcp.ts... +Updating scripts/send-newsletter.ts... Updating index.html... Updating public/llms.txt... Updating public/robots.txt... Updating public/openapi.yaml... Updating public/.well-known/ai-plugin.json... -Updating default theme in src/config/siteConfig.ts... Configuration complete! ``` @@ -93,17 +95,19 @@ The configuration script updates these files: | File | What changes | | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, features (logo gallery, GitHub contributions, visitor map, blog page, posts display, homepage, right sidebar, footer, social footer, AI chat, newsletter, contact form, newsletter admin, stats page, MCP server, dashboard, image lightbox) | +| `src/config/siteConfig.ts` | Site name, bio, GitHub username, gitHubRepo config, default theme, features (logo gallery, GitHub contributions, visitor map, blog page, posts display, homepage, right sidebar, footer, social footer, AI chat, newsletter, contact form, newsletter admin, stats page, MCP server, dashboard, image lightbox) | | `src/pages/Home.tsx` | Intro paragraph, footer links | | `src/pages/Post.tsx` | SITE_URL, SITE_NAME constants | +| `src/pages/DocsPage.tsx` | SITE_URL constant | | `convex/http.ts` | SITE_URL, SITE_NAME constants | | `convex/rss.ts` | SITE_URL, SITE_TITLE, SITE_DESCRIPTION | +| `netlify/edge-functions/mcp.ts` | SITE_URL, SITE_NAME, MCP_SERVER_NAME constants | +| `scripts/send-newsletter.ts` | Default SITE_URL constant | | `index.html` | Meta tags, JSON-LD, page title | | `public/llms.txt` | Site info, GitHub link | | `public/robots.txt` | Sitemap URL | -| `public/openapi.yaml` | Server URL, site name | +| `public/openapi.yaml` | Server URL, site name, example URLs | | `public/.well-known/ai-plugin.json` | Plugin metadata | -| `src/config/siteConfig.ts` | Default theme (`defaultTheme` field) | ## Optional settings diff --git a/scripts/configure-fork.ts b/scripts/configure-fork.ts index 51e1659..5b9c018 100644 --- a/scripts/configure-fork.ts +++ b/scripts/configure-fork.ts @@ -9,14 +9,16 @@ * - src/config/siteConfig.ts (site name, bio, GitHub username, features) * - src/pages/Home.tsx (intro paragraph, footer section) * - src/pages/Post.tsx (SITE_URL, SITE_NAME constants) + * - src/pages/DocsPage.tsx (SITE_URL constant) * - convex/http.ts (SITE_URL, SITE_NAME constants) * - convex/rss.ts (SITE_URL, SITE_TITLE, SITE_DESCRIPTION) * - index.html (meta tags, JSON-LD, title) * - public/llms.txt (site info, API endpoints) * - public/robots.txt (sitemap URL) - * - public/openapi.yaml (server URL, site name) + * - public/openapi.yaml (server URL, site name, example URLs) * - public/.well-known/ai-plugin.json (plugin metadata) - * - src/context/ThemeContext.tsx (default theme) + * - netlify/edge-functions/mcp.ts (SITE_URL, SITE_NAME constants) + * - scripts/send-newsletter.ts (SITE_URL fallback) */ import * as fs from "fs"; @@ -453,6 +455,19 @@ function updatePostTsx(config: ForkConfig): void { ]); } +// Update DocsPage.tsx +function updateDocsPageTsx(config: ForkConfig): void { + console.log("\nUpdating src/pages/DocsPage.tsx..."); + + updateFile("src/pages/DocsPage.tsx", [ + // Match any existing SITE_URL value (https://...) + { + search: /const SITE_URL = "https:\/\/[^"]+";/, + replace: `const SITE_URL = "${config.siteUrl}";`, + }, + ]); +} + // Update convex/http.ts function updateConvexHttp(config: ForkConfig): void { console.log("\nUpdating convex/http.ts..."); @@ -750,6 +765,8 @@ function updateOpenApiYaml(config: ForkConfig): void { console.log("\nUpdating public/openapi.yaml..."); const githubUrl = `https://github.com/${config.githubUsername}/${config.githubRepo}`; + // Extract domain from siteUrl for example URLs (without www. if present) + const siteUrlForExamples = config.siteUrl.replace(/^https?:\/\/(www\.)?/, "https://"); updateFile("public/openapi.yaml", [ // Match any title ending with API @@ -767,15 +784,30 @@ function updateOpenApiYaml(config: ForkConfig): void { search: /- url: https:\/\/[^\s]+\n\s+description: Production server/, replace: `- url: ${config.siteUrl}\n description: Production server`, }, - // Match any example site name + // Match site name example in schema (line 31) { - search: /example: .+\n\s+url:/g, - replace: `example: ${config.siteName}\n url:`, + search: /example: markdown sync framework/, + replace: `example: ${config.siteName}`, }, - // Match any example URL (for site URL) + // Match site URL example in schema (line 34) { - search: /example: https:\/\/[^\s]+\n\s+posts:/, - replace: `example: ${config.siteUrl}\n posts:`, + search: /example: https:\/\/markdown\.fast\n(\s+)posts:/, + replace: `example: ${siteUrlForExamples}\n$1posts:`, + }, + // Match post URL example (line 167) + { + search: /example: https:\/\/markdown\.fast\/how-to-build-blog/, + replace: `example: ${siteUrlForExamples}/how-to-build-blog`, + }, + // Match markdown URL example (line 170) + { + search: /example: https:\/\/markdown\.fast\/api\/post\?slug=how-to-build-blog/, + replace: `example: ${siteUrlForExamples}/api/post?slug=how-to-build-blog`, + }, + // Match any remaining markdown.fast URLs + { + search: /https:\/\/(www\.)?markdown\.fast/g, + replace: siteUrlForExamples, }, ]); } @@ -823,6 +855,47 @@ function updateThemeConfig(config: ForkConfig): void { ]); } +// Update netlify/edge-functions/mcp.ts +function updateMcpEdgeFunction(config: ForkConfig): void { + console.log("\nUpdating netlify/edge-functions/mcp.ts..."); + + updateFile("netlify/edge-functions/mcp.ts", [ + // Match any existing SITE_URL constant + { + search: /const SITE_URL = "https:\/\/[^"]+";/, + replace: `const SITE_URL = "${config.siteUrl}";`, + }, + // Match any existing SITE_NAME constant + { + search: /const SITE_NAME = "[^"]+";/, + replace: `const SITE_NAME = "${config.siteName}";`, + }, + // Match any existing MCP_SERVER_NAME constant (create from site name) + { + search: /const MCP_SERVER_NAME = "[^"]+";/, + replace: `const MCP_SERVER_NAME = "${config.siteName.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "")}-mcp";`, + }, + ]); +} + +// Update scripts/send-newsletter.ts +function updateSendNewsletter(config: ForkConfig): void { + console.log("\nUpdating scripts/send-newsletter.ts..."); + + updateFile("scripts/send-newsletter.ts", [ + // Match any existing SITE_URL fallback in comment + { + search: /\* - SITE_URL: Your site URL \(default: https:\/\/[^)]+\)/, + replace: `* - SITE_URL: Your site URL (default: ${config.siteUrl})`, + }, + // Match any existing SITE_URL fallback in code + { + search: /const siteUrl = process\.env\.SITE_URL \|\| "https:\/\/[^"]+";/, + replace: `const siteUrl = process.env.SITE_URL || "${config.siteUrl}";`, + }, + ]); +} + // Main function function main(): void { console.log("Fork Configuration Script"); @@ -837,6 +910,7 @@ function main(): void { updateSiteConfig(config); updateHomeTsx(config); updatePostTsx(config); + updateDocsPageTsx(config); updateConvexHttp(config); updateConvexRss(config); updateIndexHtml(config); @@ -845,6 +919,8 @@ function main(): void { updateOpenApiYaml(config); updateAiPluginJson(config); updateThemeConfig(config); + updateMcpEdgeFunction(config); + updateSendNewsletter(config); console.log("\n========================="); console.log("Configuration complete!"); diff --git a/src/components/BlogPost.tsx b/src/components/BlogPost.tsx index e5d7019..cae79cd 100644 --- a/src/components/BlogPost.tsx +++ b/src/components/BlogPost.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useRef } from "react"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; import remarkBreaks from "remark-breaks"; @@ -10,6 +10,7 @@ import { useTheme } from "../context/ThemeContext"; import NewsletterSignup from "./NewsletterSignup"; import ContactForm from "./ContactForm"; import siteConfig from "../config/siteConfig"; +import { useSearchHighlighting } from "../hooks/useSearchHighlighting"; // Whitelisted domains for iframe embeds (YouTube and Twitter/X only) const ALLOWED_IFRAME_DOMAINS = [ @@ -483,6 +484,10 @@ export default function BlogPost({ } | null>(null); const isLightboxEnabled = siteConfig.imageLightbox?.enabled !== false; + // Search highlighting - scrolls to and highlights search terms from URL + const articleRef = useRef(null); + useSearchHighlighting({ containerRef: articleRef }); + const getCodeTheme = () => { switch (theme) { case "dark": @@ -741,7 +746,7 @@ export default function BlogPost({ if (hasInlineEmbeds) { return ( <> -
+
{segments.map((segment, index) => { if (segment.type === "newsletter") { // Newsletter signup inline @@ -777,7 +782,7 @@ export default function BlogPost({ // No inline embeds, render content normally return ( <> -
+
{ - const url = anchor ? `/${slug}#${anchor}` : `/${slug}`; + const handleResultClick = (slug: string) => { + // Pass search query as URL param for highlighting on destination page + const url = `/${slug}?q=${encodeURIComponent(searchQuery)}`; navigate(url); onClose(); }; @@ -136,7 +138,7 @@ export default function SearchModal({ isOpen, onClose }: SearchModalProps) {
  • + @@ -2333,9 +2447,18 @@ published: false {/* Frontmatter Sidebar */} -