gatsby-attainlabs-cms 1.0.14 → 1.0.15

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.
Files changed (2) hide show
  1. package/gatsby-node.js +9 -9
  2. package/package.json +1 -1
package/gatsby-node.js CHANGED
@@ -11,18 +11,18 @@ const brands = {
11
11
  "Attain Finance": "attainfinance",
12
12
  };
13
13
 
14
- const createPage = async (blocks, slug, id) => {
14
+ const createPage = async (blocks, pageUrl, id) => {
15
15
  // Validate input parameters
16
- if (!Array.isArray(blocks) || !slug || !id) {
16
+ if (!Array.isArray(blocks) || !pageUrl || !id) {
17
17
  throw new Error("Invalid parameters passed to createPage.");
18
18
  }
19
19
 
20
20
  // Helper function to generate Slice components
21
- const generateSlices = (blocks, slug, id) => {
21
+ const generateSlices = (blocks, pageUrl, id) => {
22
22
  return blocks
23
23
  .map(
24
24
  (b) =>
25
- `<Slice alias="block--${slug}--${b.props.component.name}--${id}" />`
25
+ `<Slice alias="block--${pageUrl}--${b.props.component.name}--${id}" />`
26
26
  )
27
27
  .join("\n");
28
28
  };
@@ -44,7 +44,7 @@ const createPage = async (blocks, slug, id) => {
44
44
  const Page = () => {
45
45
  return (
46
46
  <Layout>
47
- ${generateSlices(blocks, slug, id)}
47
+ ${generateSlices(blocks, pageUrl, id)}
48
48
  </Layout>
49
49
  );
50
50
  };
@@ -287,7 +287,7 @@ exports.createPages = async ({ actions, store }, pluginOptions) => {
287
287
  blocks: {
288
288
  content,
289
289
  root: {
290
- props: { slug },
290
+ props: { pageUrl },
291
291
  },
292
292
  },
293
293
  },
@@ -298,7 +298,7 @@ exports.createPages = async ({ actions, store }, pluginOptions) => {
298
298
  await Promise.all(
299
299
  content.map(async (b) => {
300
300
  const name = b.props.component.name;
301
- const blockId = `block--${slug}--${name}--${id}`;
301
+ const blockId = `block--${pageUrl}--${name}--${id}`;
302
302
  console.log(`Creating slice: ${blockId}`);
303
303
  // here we could await something per slice if needed later
304
304
  createSlice({
@@ -315,8 +315,8 @@ exports.createPages = async ({ actions, store }, pluginOptions) => {
315
315
  })
316
316
  );
317
317
 
318
- const pageSource = await createPage(content, slug, id);
319
- const outPath = path.join(siteRoot, "src/pages", `${slug}.tsx`);
318
+ const pageSource = await createPage(content, pageUrl, id);
319
+ const outPath = path.join(siteRoot, "src/pages", `${pageUrl}.tsx`);
320
320
  // Generate the page itself
321
321
  await fse.outputFile(outPath, pageSource);
322
322
  console.log(`✅ Wrote page to ${outPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-attainlabs-cms",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",