binbytes/nuxt-blog-module-example

nuxt generate - links generated lead to "Network error"

Closed this issue · 4 comments

Hello!

Thanks for this project :) I'm using it for my own portfolio.

Quick question: when I use the generate command, the links in the generated static site lead to a Nuxt "Network error" page. When I look in the console, Nuxt is appending /api to all the links. I can visit the pages manually, however.

Example: In index.vue there is:

<nuxt-link
          to="/blog"
          class="button--green" exact>Blogs</nuxt-link>

But clicking on it takes me to /api/blog/ and a network error page (after generate).

Am I missing some nuxt config here? Any ideas?

@jewbetcha I had tried in one of my Nuxt projects but it has a proper link not sure what went wrong with your case, I mostly don't use generate mode. Try to look at baseUrl if you set it in nuxt.config.

@nikkanetiya So there was recently an update to blog module that helped with this (I think), and I also did some digging and found out I was missing some nuxt config.

I was able to get it to work (using latest @nuxtjs/blog-module code) by structuring my modules section of nuxt.config.js like so:

modules: {[
    ['@nuxtjs/blog', {
      static: true
    }],
   ...
}

I found this just by digging through the main contributors code for his personal site, I think it should really be added to the documentation.

@jewbetcha Thanks for the note. Yes, you can contribute to their documentation if you are sure it is missing. I am glad that you find this little demo project useful.

Thanks for putting it together 😄I will contribute to their docs!