Skip to content

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

@enddevNZ

Description

@enddevNZ
`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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions