Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After creating a new tag and requesting its collection page, Ghost returns a 404 | After update to latest Ghost release. #10433

Closed
iamsanteri opened this issue Jan 29, 2019 · 11 comments

Comments

@iamsanteri
Copy link

iamsanteri commented Jan 29, 2019

Issue Summary

In an older version of Ghost after creating a completely new tag, an automatic collection page was created with all the posts that were tagged with this particular tag.

If the tag that was just created didn't have any posts with it, the URL would still render correctly but without any tagged posts (200 - OK, successful).

After updating to the latest release I noticed that when you create a new tag and try to access the tag page, Ghost returns a 404 error. When troubleshooting I realized that after tagging any of my current posts with that new tag, only then the tag page rendered correctly.

I believe this is a bug and if implemented intentionally, it only serves to cause confusion with Ghost users.

To Reproduce

  1. Create a new tag with Ghost.
  2. Use a browser to access the new tag URL provided when creating the tag in Ghost admin panel.
  3. Receive a 404 (Page not found.)

-- Continues:
5. Tag an already published post or publish a new one with the newly created tag.
6. Use a browser to access the tag URL.
7. Receive a 200 (OK.)

-- Reproduce Again:
8. Delete the tag from the published post and re-publish it without the newly created tag again.
9. Use a browser to access the tag URL.
10. Receive a 404 (Page not found.) -> Although tag does exist in Ghost admin panel

Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?

I consider this to be a bug as the behaviour when creating new tags in Ghost before was different and made more sense.

Sometimes I think that the users of Ghost want to create a new (empty) tag collections page without any posts in it. This is because after creating a new tag and the page, one may want to include it in the navigation for testing purposes (design-tab in the Ghost admin panel) before the initial post with this tag has even been published. Currently it will just return a 404 error although the post collection page should already exist. I believe thus that this is a bug.

I think the older behaviour with Ghost rendering an empty tag page is the way to go but this is just my opinion. Your thoughts?

Technical details:

  • Ghost Version: 2.13.1
  • Node Version: 8.15.0
  • Browser/OS: Any evergreen browser, Mac OS.
  • Database: MySQL
@kevinansfield
Copy link
Contributor

This is expected behaviour for the v2 Content API which recent Casper versions use. Rendering empty tag pages and having those tags appear in sitemaps etc was a bug that's been fixed in the new API version - empty pages are not good for usability or SEO.

@dlford
Copy link

dlford commented Mar 13, 2019

In my use case this is a bug.

One of the sites I run is for a music group, it has a tag for "Upcoming Events" in the nav bar that occasionally has no posts, but the custom theme in use still has a link in that tags page to another tag "Past Events". With this new behavior I would have to add the "Past Events" tag the the nav bar, but even then having the "Upcoming Events" link return a 404 is not a good solution when there are no upcoming events, I don't want to have to keep removing "Upcoming Events" from the nav bar and adding it back, that is confusing for users and site admins.

@kevinansfield
Copy link
Contributor

@dlford if you need empty pages to exist you can set them up using the dynamic routing features https://docs.ghost.org/api/handlebars-themes/routing/

Rendering pages by default for tags with no posts is 100% a bug.

@dlford
Copy link

dlford commented Mar 14, 2019

@kevinansfield thank you for the suggestion, but using the dynamic routing features as you suggest is also broken by the new behavior. In my tag-events.hbs file I grab the feature image and text values for the events tag, but this is now unavailable when there are no posts. I end up with a blank page and a footer, this is even worse than the 404 page as there are no navigation options. So now I can re-write the template file, but how will site admins change the feature image or text? They can't.

I still think this is a bug, but I'll agree to disagree that it's 100% a matter of opinion.

@ErisDS
Copy link
Member

ErisDS commented Mar 15, 2019

@dlford please move this conversation to the forum as requested. Tags that don't have posts don't exist according to the frontend. This is intended, expected behaviour. If you have a problem you can't solve, then post on the forum about what it is you need to achieve and we'll help you find the right solution.

@joallard
Copy link

Yeesh looks like this bug is triggered quite easily from my installation even if there's a page to display.

@dlford
Copy link

dlford commented Feb 11, 2020

@joallard You can get it to work by editing the routes file in the theme. I can't remember exactly how I did it because I ended up switching to Gatsby in the long run, but the info is here as previously mentioned: https://docs.ghost.org/api/handlebars-themes/routing/

@joallard
Copy link

joallard commented Feb 11, 2020

@dlford Nope, it's a bug. When a tag is created and an article is present, the link is not 404.

And before someone tells me to file a report: (1) I have a good dozen bugs and UX issues to take care of after install, and (2) STR is finnicky.

@dlford
Copy link

dlford commented Feb 11, 2020

I don't disagree with you, this was the reason I moved away from using Ghost, introducing breaking changes and calling them features makes me hesitant to update, and that leads me to find a new solution. Haven't looked back.

@jimz-yucolab
Copy link

the bug is still there, even when i create a new tag alongside a new post :
#15608

@ErisDS
Copy link
Member

ErisDS commented Oct 13, 2022

@jimz-yucolab to be super clear the bug you've raised is totally different - it's an actual bug with tags that should have URLs 404ing incorrectly. Whereas this issue is about a breaking change we made based on feedback we got from our users where tags (and authors) that had zero associated posts were not given URLs until they had at least one post associated with them.

@TryGhost TryGhost locked as off-topic and limited conversation to collaborators Oct 13, 2022
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

6 participants