Why do tag pages without posts respond with a 404?

Ghost responds to tag pages (/tag/test/) with a 404 Not Found if the tag doesn’t exist, or if the tag exists, but has no published posts/pages attached.

Why respond with a 404 for a tag page that has been deliberately created?

Because the page doesn’t exist; it is only generated when a post is published.

1 Like

If the page is considered as “not existing”, why are the tags not deleted from the tags page when the last post/page with the tag is removed?

1 Like

my thoughts too when I saw it

There could be draft posts that use the tags. Moreover, I wouldn’t expect, or want, the action of deleting a tag to be automatic.

1 Like

Having draft posts with tags applied would explain the existence of the tag. It doesn’t explain why the tag page responds with a 404.

I agree that tags shouldn’t be deleted automatically.

But I still don’t understand why the tag page with no published posts responds with a 404. Is this considered preferable to having a tag page with no posts? If so, why?

I could ask the exact opposite - why should a tag page with no posts respond with something :slight_smile:

1 Like

why should a tag page with no posts respond with something

My site has events. I use tags to create lists of events “this week”, “next week”, “this weekend”, etc.

Just because there are no events “this weekend”, I don’t want the page to present a 404 - I think that would be very confusing for a reader.

And, for SEO purposes, I assume Google prefers a page that [sometimes] has limited content over a page that disappears and reappears regularly?

1 Like

It sounds like you’re looking for a channel or just a dedicated page :slight_smile: Ghost Themes - Dynamic URLs & Routing

2 Likes

This achieves the effect of creating a permanent page irrespective of how many posts are tagged with the matching tag. Thank you.

However, it doesn’t resolve the problem of the tag page [potentially] regularly disappearing, then reappearing.

Can the tag link be made to reference the permanent page? Wouldn’t it just be easier to be able to make the tag page itself permanent?

I personally don’t have an opinion, but the change to 404 empty tag and staff listings instead of rendering an empty page was intentional and done a few years ago.

It’s also a question of how likely and how much of an impact a tag switching between “active” and “inactive” is in the grand scheme of things - as you’ve highlighted, you have a use case where this could be problematic, but what about the other people that use Ghost?

Again, I don’t really have an opinion, just thinking out loud :slight_smile:

I tend to think this is a website housekeeping matter. If there’s an unused tag, I’d delete it.

However, I tend to use tags in the same way WordPress has categories, so I don’t have many to manage.

Could you create a “holding” post for the tags, e.g., a post that is pinned to the top of the tag page that describes the purpose of the tag/category?

4 posts were split to a new topic: Unassigned tags following import from WordPress