nextblogkit 0.7.1 → 0.7.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 CHANGED
@@ -44,9 +44,9 @@ npx nextblogkit init
44
44
  ```
45
45
 
46
46
  This creates:
47
- - `app/blog/` — Blog pages (list, post, category)
48
- - `app/admin/blog/` — Admin panel pages (dashboard, posts, media, categories, settings)
49
- - `app/api/blog/` — API routes (posts, media, categories, settings, sitemap, RSS)
47
+ - `app/blogs/` — Blog pages (list, post, category)
48
+ - `app/admin/blogs/` — Admin panel pages (dashboard, posts, media, categories, settings)
49
+ - `app/api/blogs/` — API routes (posts, media, categories, settings, sitemap, RSS)
50
50
  - `nextblogkit.config.ts` — Configuration file
51
51
  - `.env.local.example` — Environment variable template
52
52
 
@@ -100,8 +100,8 @@ This creates the required MongoDB indexes for posts, categories, and media.
100
100
  pnpm dev
101
101
  ```
102
102
 
103
- - Blog: [http://localhost:3000/blog](http://localhost:3000/blog)
104
- - Admin: [http://localhost:3000/admin/blog](http://localhost:3000/admin/blog)
103
+ - Blog: [http://localhost:3000/blogs](http://localhost:3000/blogs)
104
+ - Admin: [http://localhost:3000/admin/blogs](http://localhost:3000/admin/blogs)
105
105
 
106
106
  The admin panel will prompt you for the API key on first visit (the value of `NEXTBLOGKIT_API_KEY`).
107
107
 
@@ -116,9 +116,9 @@ import { defineConfig } from 'nextblogkit';
116
116
 
117
117
  export default defineConfig({
118
118
  // URL paths — customize to match your site structure
119
- basePath: '/blog', // Public blog URL prefix
120
- adminPath: '/admin/blog', // Admin panel URL prefix
121
- apiPath: '/api/blog', // API routes URL prefix
119
+ basePath: '/blogs', // Public blog URL prefix
120
+ adminPath: '/admin/blogs', // Admin panel URL prefix
121
+ apiPath: '/api/blogs', // API routes URL prefix
122
122
 
123
123
  // Pagination
124
124
  postsPerPage: 10,
@@ -163,7 +163,7 @@ export default defineConfig({
163
163
 
164
164
  ### Custom URL Paths
165
165
 
166
- You can change the blog URL from `/blog` to anything — `/articles`, `/posts`, `/blogs`, etc. Make sure the folder structure in your `app/` directory matches and pass the paths through to components:
166
+ You can change the blog URL from `/blogs` to anything — `/articles`, `/posts`, `/blog`, etc. Make sure the folder structure in your `app/` directory matches and pass the paths through to components:
167
167
 
168
168
  ```typescript
169
169
  export default defineConfig({
@@ -182,7 +182,7 @@ import 'nextblogkit/styles/admin.css';
182
182
 
183
183
  export default function AdminBlogLayout({ children }: { children: React.ReactNode }) {
184
184
  return (
185
- <AdminLayout apiPath="/api/articles" adminPath="/admin/articles">
185
+ <AdminLayout apiPath="/api/articles" adminPath="/admin/articles" basePath="/articles">
186
186
  {children}
187
187
  </AdminLayout>
188
188
  );
@@ -228,7 +228,7 @@ NextBlogKit uses CSS variables for theming. Every color, font, radius, and shado
228
228
  Add a `<style>` block in your blog layout or override in your global CSS:
229
229
 
230
230
  ```tsx
231
- // app/blog/layout.tsx
231
+ // app/blogs/layout.tsx
232
232
  import 'nextblogkit/styles/blog.css';
233
233
 
234
234
  export default function BlogLayout({ children }: { children: React.ReactNode }) {
@@ -340,7 +340,7 @@ import { BlogPostPage } from 'nextblogkit/components';
340
340
  | `showRelatedPosts` | `boolean` | `true` | Show related posts section |
341
341
  | `showShareButtons` | `boolean` | `true` | Show share buttons |
342
342
  | `showReadingProgress` | `boolean` | `true` | Show reading progress bar at top |
343
- | `basePath` | `string` | `'/blog'` | Blog URL prefix (for links) |
343
+ | `basePath` | `string` | `'/blogs'` | Blog URL prefix (for links) |
344
344
  | `className` | `string` | `''` | Additional CSS class |
345
345
  | `slots` | `BlogPostSlots` | — | Custom content injection (see below) |
346
346
 
@@ -384,7 +384,7 @@ interface BlogPostSlots {
384
384
  **Full page example:**
385
385
 
386
386
  ```tsx
387
- // app/blog/[slug]/page.tsx
387
+ // app/blogs/[slug]/page.tsx
388
388
  import { BlogPostPage } from 'nextblogkit/components';
389
389
  import { getPostBySlug, listPosts, generateMetaTags } from 'nextblogkit/lib';
390
390
  import type { Metadata } from 'next';
@@ -433,7 +433,7 @@ export default async function BlogPost({ params }: Props) {
433
433
  relatedPosts={JSON.parse(JSON.stringify(relatedPosts))}
434
434
  showTOC
435
435
  tocPosition="sidebar"
436
- basePath="/blog"
436
+ basePath="/blogs"
437
437
  />
438
438
  );
439
439
  }
@@ -462,8 +462,8 @@ import { BlogListPage } from 'nextblogkit/components';
462
462
  | `showCategories` | `boolean` | `true` | Show category sidebar |
463
463
  | `showSearch` | `boolean` | `true` | Show search bar |
464
464
  | `layout` | `'grid' \| 'list' \| 'magazine'` | `'grid'` | Post card layout style |
465
- | `basePath` | `string` | `'/blog'` | Blog URL prefix |
466
- | `apiPath` | `string` | `'/api/blog'` | API URL prefix (for search) |
465
+ | `basePath` | `string` | `'/blogs'` | Blog URL prefix |
466
+ | `apiPath` | `string` | `'/api/blogs'` | API URL prefix (for search) |
467
467
  | `className` | `string` | `''` | Additional CSS class |
468
468
  | `slots` | `BlogListSlots` | — | Custom content injection (see below) |
469
469
 
@@ -572,20 +572,20 @@ Wraps all admin pages with sidebar navigation and authentication.
572
572
  |------|------|---------|-------------|
573
573
  | `children` | `ReactNode` | *required* | Page content |
574
574
  | `apiKey` | `string` | — | Pre-set API key (bypasses login prompt) |
575
- | `apiPath` | `string` | `'/api/blog'` | API route prefix for all admin API calls |
576
- | `adminPath` | `string` | `'/admin/blog'` | Admin route prefix for sidebar nav links |
577
- | `basePath` | `string` | `'/blog'` | Public blog URL prefix (used for "View" links in post list and SEO preview) |
575
+ | `apiPath` | `string` | `'/api/blogs'` | API route prefix for all admin API calls |
576
+ | `adminPath` | `string` | `'/admin/blogs'` | Admin route prefix for sidebar nav links |
577
+ | `basePath` | `string` | `'/blogs'` | Public blog URL prefix (used for "View" links in post list and SEO preview) |
578
578
 
579
579
  **Important:** If you change `apiPath` or `basePath` in your config, you **must** pass them to `AdminLayout`:
580
580
 
581
581
  ```tsx
582
- // app/admin/blog/layout.tsx
582
+ // app/admin/blogs/layout.tsx
583
583
  import { AdminLayout } from 'nextblogkit/admin';
584
584
  import 'nextblogkit/styles/admin.css';
585
585
 
586
586
  export default function AdminBlogLayout({ children }: { children: React.ReactNode }) {
587
587
  return (
588
- <AdminLayout apiPath="/api/blogs" adminPath="/admin/blog" basePath="/blogs">
588
+ <AdminLayout apiPath="/api/blogs" adminPath="/admin/blogs" basePath="/blogs">
589
589
  {children}
590
590
  </AdminLayout>
591
591
  );
@@ -599,10 +599,10 @@ export default function AdminBlogLayout({ children }: { children: React.ReactNod
599
599
  Import the CSS files you need in your layout files:
600
600
 
601
601
  ```tsx
602
- // Blog pages — import in app/blog/layout.tsx
602
+ // Blog pages — import in app/blogs/layout.tsx
603
603
  import 'nextblogkit/styles/blog.css';
604
604
 
605
- // Admin pages — import in app/admin/blog/layout.tsx
605
+ // Admin pages — import in app/admin/blogs/layout.tsx
606
606
  import 'nextblogkit/styles/admin.css';
607
607
  ```
608
608
 
@@ -705,53 +705,53 @@ All API routes require a Bearer token (`NEXTBLOGKIT_API_KEY`) for write operatio
705
705
 
706
706
  | Method | Endpoint | Description |
707
707
  |--------|----------|-------------|
708
- | GET | `/api/blog/posts` | List posts (supports `?status=`, `?category=`, `?search=`, `?page=`, `?limit=`) |
709
- | GET | `/api/blog/posts?slug=my-post` | Get single post by slug |
710
- | GET | `/api/blog/posts?id=abc123` | Get single post by ID |
711
- | POST | `/api/blog/posts` | Create post |
712
- | PUT | `/api/blog/posts` | Update post (requires `?id=`) |
713
- | DELETE | `/api/blog/posts` | Delete/archive post (requires `?id=`) |
708
+ | GET | `/api/blogs/posts` | List posts (supports `?status=`, `?category=`, `?search=`, `?page=`, `?limit=`) |
709
+ | GET | `/api/blogs/posts?slug=my-post` | Get single post by slug |
710
+ | GET | `/api/blogs/posts?id=abc123` | Get single post by ID |
711
+ | POST | `/api/blogs/posts` | Create post |
712
+ | PUT | `/api/blogs/posts` | Update post (requires `?id=`) |
713
+ | DELETE | `/api/blogs/posts` | Delete/archive post (requires `?id=`) |
714
714
 
715
715
  ### Media
716
716
 
717
717
  | Method | Endpoint | Description |
718
718
  |--------|----------|-------------|
719
- | GET | `/api/blog/media` | List media files |
720
- | POST | `/api/blog/media` | Upload file (multipart/form-data) |
721
- | DELETE | `/api/blog/media?id=abc123` | Delete media file |
719
+ | GET | `/api/blogs/media` | List media files |
720
+ | POST | `/api/blogs/media` | Upload file (multipart/form-data) |
721
+ | DELETE | `/api/blogs/media?id=abc123` | Delete media file |
722
722
 
723
723
  ### Categories
724
724
 
725
725
  | Method | Endpoint | Description |
726
726
  |--------|----------|-------------|
727
- | GET | `/api/blog/categories` | List categories |
728
- | POST | `/api/blog/categories` | Create category |
729
- | PUT | `/api/blog/categories?id=abc123` | Update category |
730
- | DELETE | `/api/blog/categories?id=abc123` | Delete category |
727
+ | GET | `/api/blogs/categories` | List categories |
728
+ | POST | `/api/blogs/categories` | Create category |
729
+ | PUT | `/api/blogs/categories?id=abc123` | Update category |
730
+ | DELETE | `/api/blogs/categories?id=abc123` | Delete category |
731
731
 
732
732
  ### Settings
733
733
 
734
734
  | Method | Endpoint | Description |
735
735
  |--------|----------|-------------|
736
- | GET | `/api/blog/settings` | Get settings |
737
- | PUT | `/api/blog/settings` | Update settings |
736
+ | GET | `/api/blogs/settings` | Get settings |
737
+ | PUT | `/api/blogs/settings` | Update settings |
738
738
 
739
- > **Note:** These endpoints use the default `/api/blog` prefix. If you changed `apiPath` in your config, replace `/api/blog` with your custom path.
739
+ > **Note:** These endpoints use the default `/api/blogs` prefix. If you changed `apiPath` in your config, replace `/api/blogs` with your custom path.
740
740
 
741
741
  ### Tokens
742
742
 
743
743
  | Method | Endpoint | Description |
744
744
  |--------|----------|-------------|
745
- | GET | `/api/blog/tokens` | List API tokens (master key only) |
746
- | POST | `/api/blog/tokens` | Generate new token (master key only) |
747
- | DELETE | `/api/blog/tokens?id=abc123` | Revoke token (master key only) |
745
+ | GET | `/api/blogs/tokens` | List API tokens (master key only) |
746
+ | POST | `/api/blogs/tokens` | Generate new token (master key only) |
747
+ | DELETE | `/api/blogs/tokens?id=abc123` | Revoke token (master key only) |
748
748
 
749
749
  ### Authentication
750
750
 
751
751
  Include the API key or a generated token as a Bearer token:
752
752
 
753
753
  ```bash
754
- curl -X POST http://localhost:3000/api/blog/posts \
754
+ curl -X POST http://localhost:3000/api/blogs/posts \
755
755
  -H "Authorization: Bearer your-api-key-here" \
756
756
  -H "Content-Type: application/json" \
757
757
  -d '{"title": "My Post", "content": [...], "status": "published"}'
@@ -815,6 +815,7 @@ Type `/` in the editor to open the command menu:
815
815
  | Blockquote | Quote block |
816
816
  | Code Block | Syntax-highlighted code |
817
817
  | Image | Upload an image |
818
+ | Media Library | Choose from uploaded images (when `onBrowseMedia` is provided) |
818
819
  | Table | Insert a 3x3 table |
819
820
  | Divider | Horizontal rule |
820
821
  | Callout | Info/warning/tip/danger box |
@@ -835,7 +836,7 @@ function MyEditor() {
835
836
  const formData = new FormData();
836
837
  formData.append('file', file);
837
838
 
838
- const res = await fetch('/api/blog/media', {
839
+ const res = await fetch('/api/blogs/media', {
839
840
  method: 'POST',
840
841
  headers: { Authorization: `Bearer ${apiKey}` },
841
842
  body: formData,
@@ -865,8 +866,8 @@ NextBlogKit automatically generates:
865
866
  - **Open Graph** — og:title, og:description, og:image, og:type
866
867
  - **Twitter Cards** — twitter:card, twitter:title, twitter:description
867
868
  - **JSON-LD** — BlogPosting and FAQPage structured data
868
- - **Sitemap** — Dynamic XML sitemap at `/api/blog/sitemap.xml`
869
- - **RSS** — RSS 2.0 feed at `/api/blog/rss.xml`
869
+ - **Sitemap** — Dynamic XML sitemap at `/api/blogs/sitemap.xml`
870
+ - **RSS** — RSS 2.0 feed at `/api/blogs/rss.xml`
870
871
 
871
872
  The built-in SEO scorer checks 17 factors including keyword density, title length, heading hierarchy, image alt text, and readability.
872
873
 
@@ -895,11 +896,11 @@ Running `npx nextblogkit init` creates thin wrapper files inside your `app/` dir
895
896
 
896
897
  ```
897
898
  app/
898
- ├── blog/
899
+ ├── blogs/
899
900
  │ ├── page.tsx # Blog list page
900
901
  │ ├── [slug]/page.tsx # Individual post page (with SEO metadata)
901
902
  │ └── category/[slug]/page.tsx # Category filter page
902
- ├── admin/blog/
903
+ ├── admin/blogs/
903
904
  │ ├── layout.tsx # Admin layout with sidebar
904
905
  │ ├── page.tsx # Dashboard
905
906
  │ ├── posts/page.tsx # Post list
@@ -908,7 +909,7 @@ app/
908
909
  │ ├── media/page.tsx # Media library
909
910
  │ ├── categories/page.tsx # Category manager
910
911
  │ └── settings/page.tsx # Settings
911
- └── api/blog/
912
+ └── api/blogs/
912
913
  ├── posts/route.ts # Posts CRUD
913
914
  ├── media/route.ts # Media upload/list/delete
914
915
  ├── categories/route.ts # Categories CRUD