From 1629af1f7290cbc22384e024c9d8d82fa1f6a2a4 Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:30:12 -0500 Subject: [PATCH 1/2] enable cre cli template cmd --- .../CRETemplate/CRETemplateOverview.astro | 76 +++++++++++-------- src/content.config.ts | 1 + .../cre-templates/bring-your-own-data.mdx | 1 + src/layouts/CRETemplateLayout.astro | 5 +- src/pages/cre-templates/[...id].astro | 7 +- 5 files changed, 51 insertions(+), 39 deletions(-) diff --git a/src/components/CRETemplate/CRETemplateOverview.astro b/src/components/CRETemplate/CRETemplateOverview.astro index e8c509ba151..3de57674b57 100644 --- a/src/components/CRETemplate/CRETemplateOverview.astro +++ b/src/components/CRETemplate/CRETemplateOverview.astro @@ -3,9 +3,8 @@ import { CRETemplatesFrontmatter } from "~/content.config.ts" interface Props { frontmatter: CRETemplatesFrontmatter - templateSlug: string } -const { frontmatter, templateSlug } = Astro.props +const { frontmatter } = Astro.props ---
@@ -28,33 +27,43 @@ const { frontmatter, templateSlug } = Astro.props

{frontmatter.description}

- - + ) : ( +
+ + + - + View on GitHub +
-
- - - -
- - - - - View on GitHub - -
+ ) + } @@ -121,7 +130,6 @@ const { frontmatter, templateSlug } = Astro.props max-width: 500px; } - /* Hidden until CLI is available — remove style="display: none;" from .get-template to re-enable */ .get-template { display: flex; flex-direction: column; @@ -137,7 +145,7 @@ const { frontmatter, templateSlug } = Astro.props .template-actions { display: flex; flex-wrap: wrap; - align-items: center; + align-items: stretch; gap: var(--space-3x); } @@ -145,7 +153,7 @@ const { frontmatter, templateSlug } = Astro.props display: inline-flex; align-items: center; gap: var(--space-3x); - padding: 12px 18px; + padding: 0 18px; background: #1e293b; border-radius: 6px; font-family: var(--font-mono, monospace); @@ -201,10 +209,14 @@ const { frontmatter, templateSlug } = Astro.props font-size: 14px; font-weight: 600; border: 1px solid #0847f7; - border-radius: 4px; + border-radius: 6px; text-decoration: none; transition: all 0.2s ease; - min-width: 120px; + white-space: nowrap; + } + + .github-buttons .github-btn { + padding: 12px 28px; } .github-btn:hover { diff --git a/src/content.config.ts b/src/content.config.ts index 3120ab1d897..df405f0aa0c 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -102,6 +102,7 @@ const creTemplatesFrontmatter = z ), // Links to GitHub folders for each language variant image: z.string(), featured: z.boolean().optional(), // Whether this template is featured on the hub page + cliTemplateId: z.string().optional(), // CLI ID for `cre init --template=` — if set, the command box is shown datePublished: z.string().optional(), // ISO date string lastModified: z.string().optional(), // ISO date string }) diff --git a/src/content/cre-templates/bring-your-own-data.mdx b/src/content/cre-templates/bring-your-own-data.mdx index 0dab6a76e5b..941833d1595 100644 --- a/src/content/cre-templates/bring-your-own-data.mdx +++ b/src/content/cre-templates/bring-your-own-data.mdx @@ -4,6 +4,7 @@ description: "A template for bringing your own off-chain Proof-of-Reserve (PoR) author: "Chainlink Labs" excerpt: "Publish verified financial or reserve data to smart contracts using CRE." image: "thumbnail.jpg" +cliTemplateId: "bring-your-own-data" githubUrl: "https://github.com/smartcontractkit/cre-templates/tree/main/starter-templates/bring-your-own-data" githubRepoLinks: - label: "Go" diff --git a/src/layouts/CRETemplateLayout.astro b/src/layouts/CRETemplateLayout.astro index f3e3a719cb6..a697369a868 100644 --- a/src/layouts/CRETemplateLayout.astro +++ b/src/layouts/CRETemplateLayout.astro @@ -9,10 +9,9 @@ import { CRETemplatesFrontmatter } from "~/content.config.ts" interface Props { frontmatter: CRETemplatesFrontmatter headings: MarkdownHeading[] - templateSlug: string } -const { frontmatter, headings, templateSlug } = Astro.props +const { frontmatter, headings } = Astro.props --- Back to Hub - + diff --git a/src/pages/cre-templates/[...id].astro b/src/pages/cre-templates/[...id].astro index 9802d503951..a680bc0f7f7 100644 --- a/src/pages/cre-templates/[...id].astro +++ b/src/pages/cre-templates/[...id].astro @@ -10,21 +10,20 @@ export async function getStaticPaths() { return { params: { id: routeId }, - props: { entry, templateSlug: routeId }, + props: { entry }, } }) } interface Props { entry: Awaited>>[number] - templateSlug: string } -const { entry, templateSlug } = Astro.props +const { entry } = Astro.props const { Content, headings } = await render(entry) --- - + From 1e69f63eefe1ab1d97a822e0f5a937e32573908e Mon Sep 17 00:00:00 2001 From: Karim <98668332+khadni@users.noreply.github.com> Date: Mon, 16 Mar 2026 17:54:53 -0500 Subject: [PATCH 2/2] enable several template IDs --- .../CRETemplate/CRETemplateOverview.astro | 79 ++++++++++++++++--- src/content.config.ts | 9 ++- .../cre-templates/bring-your-own-data.mdx | 6 +- .../cre-templates/custom-data-feed.mdx | 5 ++ .../cre-templates/indexer-block-trigger.mdx | 5 ++ .../cre-templates/indexer-data-fetch.mdx | 5 ++ src/content/cre-templates/kv-store.mdx | 5 ++ .../multi-chain-token-manager.mdx | 5 ++ src/content/cre-templates/read-data-feeds.mdx | 9 +++ 9 files changed, 117 insertions(+), 11 deletions(-) diff --git a/src/components/CRETemplate/CRETemplateOverview.astro b/src/components/CRETemplate/CRETemplateOverview.astro index 3de57674b57..7de67e1fa3a 100644 --- a/src/components/CRETemplate/CRETemplateOverview.astro +++ b/src/components/CRETemplate/CRETemplateOverview.astro @@ -28,15 +28,27 @@ const { frontmatter } = Astro.props

{frontmatter.description}

{ - frontmatter.cliTemplateId ? ( + frontmatter.cliTemplateIds?.length ? (
Get the template
+ {frontmatter.cliTemplateIds.length > 1 && ( +
+ {frontmatter.cliTemplateIds.map((entry, i) => ( + + ))} +
+ )}
- cre init --template={frontmatter.cliTemplateId} + + cre init --template={frontmatter.cliTemplateIds[0].id} +