nuxtent-module
nuxtent-module copied to clipboard
404 on refresh post
Describe the bug Hello, That's my problem: When I go to my blog, the list of articles is displayed well. Once I go to an article and refresh the page I find a 404 error. Looking more ready the networks I realize that the .JSON normally called has two points after refreshment (Myurl.com/_nuxt/content/name..json) Someone will have an idea where it might come from? Thx for your rep :+1:
To Reproduce
- Go to 'https://influx-agence.netlify.com/blog/'
- Click on 'My second blog'
- Look the web console network ( 2018.premier-posts.json )
- Refresh page
- The page is 404
- Look web console network ( 2018.premier-posts**..**json )
Screenshots
3. Before refresh
6. After refresh
Applicable Versions:
- Nuxt : Last
- Netlify CMS : Last
- Node.JS : 8.12.0
CMS configuration
backend:
name: github
repo: influx-agence/Nuxtlify
branch: master
media_folder: "static/uploads"
display_url: https://influx-agence.netlify.com
collections: # A list of collections the CMS should be able to edit
- name: "blog" # Used in routes, ie.: /admin/collections/:slug/edit
label: "Blog" # Used in the UI, ie.: "New Post"
folder: "content/posts"
extension: "json"
format: "json"
create: true
slug: "{{year}}-{{slug}}"
fields: # The fields each document in this collection have
- {label: "Title", name: "title", widget: "string", tagname: "h1"}
- {label: "Publish Date", name: "date", widget: "datetime", format: "DD-MM-YYYY"}
- {label: "Cover Image", name: "image", widget: "image", required: false, tagname: ""}
- {label: "Body", name: "body", widget: "markdown"}
meta:
- {label: "SEO Description", name: "description", widget: "text"}
Additional context https://github.com/influx-agence/Nuxtlify
This is a Nuxt 404, it doesn't seem to be specific to the Nuxtend module.
What I assume happens is this:
- You land on https://influx-agence.netlify.com/blog/ and Nuxt bootstraps in SPA mode
- You then click on the blog link. Client-side routing kicks in, so Nuxt knows what to serve you
- Now you reload the page. The request arrives server-side, but there is no route for this page, so you get a 404
To fix this, you have two options:
- Manually define a route for every blog post (not very practical)
- Rewrite all requests to be served by your root page so that Nuxt can bootstrap
The latter is the common approach. You can find an example of how to do that in the Netlify documentation: https://www.netlify.com/docs/redirects/#history-pushstate-and-single-page-apps
I am fairly confident that will fix your issue. Although to be honest, I would have been more confident if it was a Netlify 404.
Okay i create _redirects in my static folder
The problem remains the same. I'm no more error 404 but the .json still has two points ..
@influx-agence as I pointed out in here, the problem was that nuxtent does not support json file types, just changing it to markdown format and using a yaml frontmatter format fixed the issue, also you can use a yaml format for your data or even mixing it.
Like this ? ( thx cesasol for rep :) )
Update 19/09 :
Same problem
Sorry but I don't know anything about netlify cms
up
Has anyone found a work-around? This is definitely a Nuxtent issue apparent with static generated MD content. All the content fails to refresh or load directly with the 404 trying to load post name..json
(notice the two dots)