From 2301c8b6fc9729c1a1844637b3212d70bfbebe5a Mon Sep 17 00:00:00 2001 From: Fran Agulto Date: Fri, 21 Feb 2025 15:06:19 -0600 Subject: [PATCH 1/3] Update index.mdx --- src/pages/docs/how-to/basic-setup/index.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/pages/docs/how-to/basic-setup/index.mdx b/src/pages/docs/how-to/basic-setup/index.mdx index 2bf913bb..bf03ecb2 100644 --- a/src/pages/docs/how-to/basic-setup/index.mdx +++ b/src/pages/docs/how-to/basic-setup/index.mdx @@ -101,6 +101,23 @@ export default function App({ Component, pageProps }) { ); } ``` +### G. Update the "Home" Page + +Ensure you have a `/src/pages/index.js` file in order for the catch-all to work properly. + +This could either be a hard-coded page or a faust page, such as: + +```js title="src/pages/index.js" +import { getWordPressProps, WordPressTemplate } from "@faustwp/core" + +export default function Page(props: any) { + return +} + +export function getStaticProps(ctx: any) { + return getWordPressProps({ ctx }) +} +``` ## 2. Set up the Template Hierarchy From 56e2a5b32c839d12050fa6f95e0dc4be2de51d06 Mon Sep 17 00:00:00 2001 From: Fran Agulto Date: Fri, 21 Feb 2025 15:09:47 -0600 Subject: [PATCH 2/3] Update index.mdx --- src/pages/docs/how-to/basic-setup/index.mdx | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/pages/docs/how-to/basic-setup/index.mdx b/src/pages/docs/how-to/basic-setup/index.mdx index bf03ecb2..edd58d32 100644 --- a/src/pages/docs/how-to/basic-setup/index.mdx +++ b/src/pages/docs/how-to/basic-setup/index.mdx @@ -101,23 +101,6 @@ export default function App({ Component, pageProps }) { ); } ``` -### G. Update the "Home" Page - -Ensure you have a `/src/pages/index.js` file in order for the catch-all to work properly. - -This could either be a hard-coded page or a faust page, such as: - -```js title="src/pages/index.js" -import { getWordPressProps, WordPressTemplate } from "@faustwp/core" - -export default function Page(props: any) { - return -} - -export function getStaticProps(ctx: any) { - return getWordPressProps({ ctx }) -} -``` ## 2. Set up the Template Hierarchy @@ -225,6 +208,25 @@ This catch-all route tells Next.js to use the templates to render pages. Note that it is still possible to override this with hardcoded pages. For example, if you have a page in your WordPress site with a URI of `/about`, Faust.js will render that page using the relevant template in your project's `wp-templates` folder. However, if you add a `src/pages/about.js` file to your project, Next.js will render the `/about` path in your app using that file instead. +### D. Update the "Home" Page + +Ensure you have a `/src/pages/index.js` file in order for the catch-all to work properly. + +This could either be a hard-coded page or a faust page, such as: + +```js title="src/pages/index.js" +import { getWordPressProps, WordPressTemplate } from "@faustwp/core" + +export default function Page(props: any) { + return +} + +export function getStaticProps(ctx: any) { + return getWordPressProps({ ctx }) +} +``` +Having this index will allow you to have WordPress + Faust on your home page. + ### D. Test your template You should now be able to make use of this template. From e606f6cfa61f850a5f067818b2b93a176f4032bb Mon Sep 17 00:00:00 2001 From: Fran Agulto Date: Fri, 21 Feb 2025 15:10:35 -0600 Subject: [PATCH 3/3] Update index.mdx --- src/pages/docs/how-to/basic-setup/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/docs/how-to/basic-setup/index.mdx b/src/pages/docs/how-to/basic-setup/index.mdx index edd58d32..4a670d81 100644 --- a/src/pages/docs/how-to/basic-setup/index.mdx +++ b/src/pages/docs/how-to/basic-setup/index.mdx @@ -227,7 +227,7 @@ export function getStaticProps(ctx: any) { ``` Having this index will allow you to have WordPress + Faust on your home page. -### D. Test your template +### E. Test your template You should now be able to make use of this template.