react-next-boilerplate icon indicating copy to clipboard operation
react-next-boilerplate copied to clipboard

[...slug].js dev mode will not show draft entries

Open enddevNZ opened this issue 3 years ago • 0 comments

`export async function getStaticPaths() {
    const storyblokApi = getStoryblokApi();
    let { data } = await storyblokApi.get("cdn/links/");

    let paths = [];
    Object.keys(data.links).forEach((linkKey) => {
      if (data.links[linkKey].is_folder || data.links[linkKey].slug === "home") {
        return;
      }

      const slug = data.links[linkKey].slug;
      let splittedSlug = slug.split("/");

      paths.push({ params: { slug: splittedSlug } });
   });

    return {
      paths: paths,
      fallback: false,
    };
}`

No sbParams included in the links call on your template, confused me when trying to view draft stories in dev mode. I kept getting errors that the story did not exist, only once published it worked.

enddevNZ avatar Jun 21 '22 10:06 enddevNZ