import { useRouter } from 'next/router'; import DefaultErrorPage from 'next/error'; import Head from 'next/head'; import React from 'react'; import { BuilderComponent, builder, useIsPreviewing, Builder } from '@builder.io/react'; // Initialize the Builder SDK with your organization's API Key // Find the API Key on: https://builder.io/account/settings builder.init("37b11147aa464a4d9525b2ab66c319f7"); export async function getStaticProps({ params }) { // Fetch the first page from Builder that matches the current URL. // Use the `userAttributes` field for targeting content. // For more, see https://www.builder.io/c/docs/targeting-with-builder const page = await builder .get('page', { userAttributes: { urlPath: '/' + (params?.page?.join('/') || ''), }, }) .toPromise(); return { props: { page: page || null, }, revalidate: 5, }; } export async function getStaticPaths() { // Fetch all published pages for the current model. // Using the `fields` option will limit the size of the response // and only return the `data.url` field from the matching pages. const pages = await builder.getAll('page', { fields: 'data.url', // only request the `data.url` field options: { noTargeting: true }, limit: 0, }); return { paths: pages.map(page => `${page.data?.url}`), fallback: true, }; } export default function Page({ page }) { const router = useRouter(); // This flag indicates if you are viewing the page in the Builder editor. const isPreviewing = useIsPreviewing(); if (router.isFallback) { return
{props.description}