astro-blog-kit 0.1.6 → 0.1.8

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.
@@ -4,4 +4,5 @@
4
4
 
5
5
  export { default as MagazineLayout } from "./MagazineLayout.astro";
6
6
  export { default as GridLayout } from "./GridLayout.astro";
7
- export { default as ListLayout } from "./ListLayout.astro";
7
+ export { default as FeaturedLayout } from "./FeaturedLayout.astro";
8
+ export { default as CardsLayout } from "./CardsLayout.astro";
@@ -6,6 +6,9 @@ import GridLayout from "./BlogList/GridLayout.astro";
6
6
  import ListLayout from "./BlogList/ListLayout.astro";
7
7
  import Pagination from "./Pagination.astro";
8
8
 
9
+ import FeaturedLayout from "./BlogList/FeaturedLayout.astro";
10
+ import CardsLayout from "./BlogList/CardsLayout.astro";
11
+
9
12
  interface Props extends BlogListProps {}
10
13
 
11
14
  const {
@@ -61,7 +64,7 @@ const blogBase = getBlogBase(locale, base);
61
64
  />
62
65
  )}
63
66
 
64
- {layout === "list" && (
67
+ {layout === "featured" && (
65
68
  <ListLayout
66
69
  posts={posts}
67
70
  currentPage={currentPage}
@@ -74,6 +77,19 @@ const blogBase = getBlogBase(locale, base);
74
77
  />
75
78
  )}
76
79
 
80
+ {layout === "cards" && (
81
+ <CardsLayout
82
+ posts={posts}
83
+ currentPage={currentPage}
84
+ totalPages={totalPages}
85
+ basePath={basePath}
86
+ blogBase={blogBase}
87
+ dateLocale={dateLocale}
88
+ t={t}
89
+ locale={locale}
90
+ />
91
+ )}
92
+
77
93
  <Pagination
78
94
  currentPage={currentPage}
79
95
  totalPages={totalPages}
@@ -10,5 +10,5 @@ export { default as BlogPost } from "./BlogPost.astro";
10
10
  export { default as Pagination } from "./Pagination.astro";
11
11
  export { default as Comments } from "./Comments.astro";
12
12
  export { default as CommentForm } from "./CommentForm.astro";
13
+ export { MagazineLayout, GridLayout, FeaturedLayout, CardsLayout } from "./BlogList/index.ts";
13
14
 
14
- export { MagazineLayout, GridLayout, ListLayout } from "./BlogList/index.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-blog-kit",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A ready-to-use blog system for Astro with WordPress headless support, optional i18n, multiple layouts, and a comment system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,6 +17,8 @@ const t = {
17
17
  btn_next: "Next",
18
18
  },
19
19
  };
20
+
21
+ const base = import.meta.env.BASE_URL;
20
22
  ---
21
23
 
22
24
  <html lang={config.locale ?? "en"}>
@@ -31,7 +33,8 @@ const t = {
31
33
  currentPage={1}
32
34
  totalPages={totalPages}
33
35
  basePath="/blog/page/"
34
- blogBase="/blog/"
36
+ basePath={`${base}blog/page/`}
37
+ blogBase={`${base}blog/`}
35
38
  dateLocale={config.locale ?? "en"}
36
39
  t={t}
37
40
  locale={config.locale ?? "en"}
@@ -5,7 +5,8 @@ import config from "../../../../blog.config";
5
5
 
6
6
  export async function getStaticPaths() {
7
7
  const wp = createWPClient(config.wpUrl);
8
- const { posts } = await wp.getPosts({ perPage: 100 });
8
+
9
+ const posts = await wp.getAllPosts();
9
10
  return getStaticPathsForPages(posts, { postsPerPage: config.postsPerPage ?? 5 });
10
11
  }
11
12
 
@@ -22,6 +23,8 @@ const t = {
22
23
  btn_next: "Next",
23
24
  },
24
25
  };
26
+
27
+ const base = import.meta.env.BASE_URL;
25
28
  ---
26
29
 
27
30
  <html lang={config.locale ?? "en"}>
@@ -35,8 +38,8 @@ const t = {
35
38
  posts={posts}
36
39
  currentPage={currentPage}
37
40
  totalPages={totalPages}
38
- basePath="/blog/page/"
39
- blogBase="/blog/"
41
+ basePath={`${base}blog/page/`}
42
+ blogBase={`${base}blog/`}
40
43
  dateLocale={config.locale ?? "en"}
41
44
  t={t}
42
45
  locale={config.locale ?? "en"}
package/types.ts CHANGED
@@ -41,7 +41,7 @@ export interface BlogPost {
41
41
 
42
42
  // ── Layouts ───────────────────────────────────────────────────
43
43
 
44
- export type BlogListLayout = "grid" | "list" | "magazine";
44
+ export type BlogListLayout = "grid" | "magazine" | "featured" | "cards";
45
45
 
46
46
  // ── i18n ──────────────────────────────────────────────────────
47
47