Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

404 on refresh post #180

Open
influx-agence opened this issue Sep 13, 2018 · 7 comments
Open

404 on refresh post #180

influx-agence opened this issue Sep 13, 2018 · 7 comments

Comments

@influx-agence
Copy link

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 👍

To Reproduce

  1. Go to 'https://influx-agence.netlify.com/blog/'
  2. Click on 'My second blog'
  3. Look the web console network ( 2018.premier-posts.json )
  4. Refresh page
  5. The page is 404
  6. Look web console network ( 2018.premier-posts**..**json )

Screenshots
3. Before refresh
image
6. After refresh
image

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 question is available on Nuxt community (#c7729)
@joostdecock
Copy link
Collaborator

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.

@influx-agence
Copy link
Author

influx-agence commented Sep 17, 2018

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 ..

image

@cesasol
Copy link
Collaborator

cesasol commented Sep 18, 2018

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

@influx-agence
Copy link
Author

influx-agence commented Sep 18, 2018

Like this ? ( thx cesasol for rep :) )
image
Update 19/09 :
Same problem

@cesasol
Copy link
Collaborator

cesasol commented Sep 20, 2018

Sorry but I don't know anything about netlify cms

@influx-agence
Copy link
Author

up

@chadananda
Copy link

chadananda commented Jan 31, 2019

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants