-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd0be7b
commit 60676dc
Showing
12 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
// src/posts/[slug]/index.build.ts | ||
import { Config } from "domco"; | ||
|
||
const params = [ | ||
{ slug: "first-post" }, | ||
{ slug: "second-post" }, | ||
{ slug: "third-post" }, | ||
] as const; | ||
/** | ||
* Generates an array of objects with slugs from 1 to n. | ||
* @param count The number of objects to generate. | ||
* @returns An array of objects with slug properties. | ||
*/ | ||
const generateSlugs = (count: number) => { | ||
const params = []; | ||
for (let i = 1; i <= count; i++) { | ||
params.push({ slug: `${i}-post` }); | ||
} | ||
return params; | ||
}; | ||
|
||
export const config: Config<typeof params> = { | ||
params, | ||
export const config: Config = { | ||
params: generateSlugs(2), | ||
build: ({ document }, { params }) => { | ||
const h1 = document.querySelector("h1"); | ||
if (h1) h1.textContent = params.slug; // "first-post" | "second-post" | "third-post" | ||
if (h1) h1.textContent = params.slug as string; | ||
}, | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters