File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,32 @@ export class NextDrupalPages extends NextDrupal {
126126 * }
127127 * ```
128128 * @examples
129+ * Fetch a resource from context.
130+ * ```ts title=pages/[[...slug]].tsx
131+ * export async function getStaticProps(context) {
132+ * const node = await drupal.getResourceFromContext("node--page", context)
129133 *
134+ * return {
135+ * props: {
136+ * node,
137+ * },
138+ * }
139+ * }
140+ * ```
141+ * Fetch a resource from context in a sub directory.
142+ * ```ts title=pages/articles/[[...slug]].tsx
143+ * export async function getStaticProps(context) {
144+ * const node = await drupal.getResourceFromContext("node--page", context, {
145+ * pathPrefix: "/articles",
146+ * })
147+ *
148+ * return {
149+ * props: {
150+ * node,
151+ * },
152+ * }
153+ * }
154+ * ```
130155 * Using DrupalNode type:
131156 * ```ts
132157 * import { DrupalNode } from "next-drupal"
You can’t perform that action at this time.
0 commit comments