storyblok / storyblok-nuxt

Storyblok Nuxt module
https://www.storyblok.com/tp/nuxt-js-multilanguage-website-tutorial
MIT License
279 stars 44 forks source link

Unpublished pages are published #165

Closed mtskf closed 2 years ago

mtskf commented 2 years ago

With the given approach described in readme file, all the unpublished pages are publicly accessible.

const story = await useStoryblok("vue", { version: "draft" });

Is it possible to apply version: "published" if not accessed from Storyblok editor? Please advise!

Dawntraoz commented 2 years ago

Hi @mtskf, for sure!

One way to do that is using useRoute().query._storyblok ? "draft" : "published" as Daniel Kelly explains in the Jamstack course.

Another way is to use .env variables in your hosting provider, something like:

{ version: process.env.STORYBLOK_VERSION }

I hope this resolves your query 🤗