Help with index page and static rendering (Nuxt)

Hi there,

Just getting started and playing around with Storyblok with Nuxt and have run into two things I can’t work out.

  1. How do I get a page to be the index of the website (i.e. website.com) with no Slug. Every time I create an entry with no slug it automatically fills that out, or if I try tick the “Define as root for the folder” I get the following error (presumably because it’s not in a folder - but I don’t want it to be):

  2. After following this post to update my config file, when trying to generate a static version of my site the one page that I have set up with Storyblok (/home) works fine when viewing locally when running the dev server, but isn’t being generated when running npm run generate

    all that’s in the /dist folder is an index page (no /home page):

    Screen Shot 2020-04-09 at 3.48.00 PM

Any help on these questions would be much appreciated!

How do I get a page to be the index of the website (i.e. website.com) with no Slug. Every time I create an entry with no slug it automatically fills that out, or if I try tick the “Define as root for the folder” I get the following error (presumably because it’s not in a folder - but I don’t want it to be):

All your entries/stories have to have defined the slug - this is the way you can get them from our API. The only exception is if you want to have a page that acts as root of the folder. In the case of the root folder (level 0) - there is not this possibility as this will be in collision with API - so you will have to define a slug name to you index page (www.webstie.com) - The GET for the index story and multiple stories would looks identical.

After following this post to update my config file, when trying to generate a static version of my site the one page that I have set up with Storyblok ( /home ) works fine when viewing locally when running the dev server, but isn’t being generated when running npm run generate

Yes and that is correct. :slight_smile: The generate is special in Nuxt and it doesn’t generate dynamic routes - you will have to provide to generate.routes a list of routes that should be generated - check this in Nuxt.js documentation - https://nuxtjs.org/api/configuration-generate/#routes. You can get links (or routes of your websites) from storyblok using the Links Endpoint in Delivery API - check this - https://www.storyblok.com/docs/api/content-delivery#core-resources/links/links

Thanks Samuel – after reading through the api docs a bit more I managed to get it going!