Error 404 not found after editing a published post

I have a custom routes.yaml wich is working well, but when I edit a published post (adding text or checking the feature option), once I click ‘update’ the post is 404.

Also, I can see that the post still appears as a postcard in the 404 page.

Here is my routes file:

routes:

collections:
  /:
    permalink: /{author}/{primary_tag}/{slug}/
    template: index

taxonomies:
  tag: /edicion/{slug}/
  author: /area/{slug}/

The only way to solve this probelm is to restart Ghost

Did you change the post slug? If so, did you refresh the original page in your browser?

No, the slug is the same. Only change de content or if its featured. Once I update them, I refresh the post on the browser and throws 404 (i try to access them from other devices and have the same problem)

Please provide the information requested in the support template that was included when creating your opening post.

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

  • What’s your URL? This is the easiest way for others to help you
  • What version of Ghost are you using? If it’s not the latest, please update Ghost first before opening your topic

And

  • How was Ghost installed and configured?
  • What Node version, database, OS & browser are you using?
  • What errors or information do you see in the console?
  • What steps could someone else take to reproduce the issue you’re having?

Could you please also post your routes.yaml file? (You can getting it from Ghost Settings (gear icon) > Labs > Download Routes.yaml . Be sure to use the code button (</>) at the top of the forum post editor, so that the forum does’t mangle it.

It’s possible that whether a post is featured or has a specific tag can change the post’s URL, if the routes file is set up that way. Let’s rule that out as the problem. :)

Sorry, here it goes:

Url: navarralanparty.org
Ghost is installed on docker container with ghost:5.8.2-alpine version
Database is also on docker percona/percona-server:8.0.28-19
Browser: Usually chrome, but tested on mozilla firefox, edge, and safari

The console does no have any errors when I edit the post (PUT request have 200 code), after refreshing the page show 404 error

The routes file is the provided on the first post

Thanks for your help

Whoops, totally missed it originally. :) Not enough coffee yet this morning, I guess.

Do your edits change the author or primary tag? I wonder if this is a problem that Ghost is redirecting to the wrong URL after publication or whether the actual routing is messed up.

I’m going to load up that routes.yaml on my dev box and see if I can reproduce.

No problem ;)
The tags and authors are not changed (as they represent different areas and edtions of our event). The only thing we update is the content itself or if the post if featured or not

Thanks again for your support

I can reproduce. The editor actually produces a 404 url immediately after the post being published (the pop-up ‘view post’ toast item shows the 404 link, NOT a url that happens to 404.

Oh, hang on. Can you swap in primary_author for author…? That stops the breakage, BUT the urls are showing up like: https://demo.spectralwebservices.com/all/china/a-post-with-an-author-and-a-tag/. (My author’s name is NOT all.) So that’s closer, but still not quite right.

So this is related to the routes.yaml. {author} is not a valid setting according to the docs - what would it do if you had multiple authors?

{primary_author} should be a valid variable and is presumably what you wanted, but doesn’t work right – it gets replaced with ‘all’ in the post URL.

I’m actually surprised that you said using {author} works after reboot - I’m testing on Ghost Pro today, so I don’t have that option. (What urls do your posts show up under after you reboot?)

I went to a more standard routes.yaml, to see if {primary_author} would work there.

routes:

collections:
  /:
    permalink: /{primary_author}/{slug}/
    template: index

taxonomies:
  tag: /edicion/{slug}/
  author: /area/{slug}/

I don’t get a 404, but posts are at /all/{slug}, not /catherine/{slug}
I can type in the URL that includes the primary author’s slug, but I get redirected to /all/{slug}.

I’ve tested your routes.yaml and works when I update the post. Now only fails if i modify the Feature this post option.

Are you getting the right url, with author name? I wasn’t….

If I restart my container yes, but once I edit anything the url is with all as author name. I don´t know why this happens

Have you found a way around this? It’s still a problem. I’m on the latest version of Ghost. A fresh install. Instead of the author, it’s ‘all’ all the way. But yes, I can get some relief from restarting Ghost if I don’t edit it anymore. Even for a new post, the problem’s there. I can’t restart Ghost every time a new post is published.