[Question] wiki pages of existing tags which weren't created yet return a 404?

In category: Site Bug Reports & Feature Requests

What the title says. I was playing around with a userscript, and while using XMLHttpRequest and found out that a wiki page which wasn't created yet returns a 404, and its contents, 304. This happens even if there already is a tag with that name, and thus, a placeholder page with a "recent posts". The API returns a flat 404 error. Am I missing something here, or is it intended to be like that?


Wiki pages are distinct from tags, which means that while it tries to be helpful by displaying posts for the case of when a tag and wiki_page have the same name, no wiki page is automatically created when a tag is created.

So this is both intended and behaving as expected.


Interesting. When using XMLHttpRequest to fetch just HTML files, it's customary to add a sanity check akin to if (XMLHttpRequest.status == 200), but this fails in the case of these wiki pages. I'm aware I can use a different check for these cases since this is a very specific case, such as searching the response for the text "Recent Posts", but still, for the sake of my learning, are you aware of any way I could receive a 200 from those pages?


If you want recent posts for a tag, run a search against /post/index.json and use JSONP


Hmmm, I wasn't familiar with JSONP, I'm still learning the ropes, thanks for the tip. It seems to be a way to grab external JS or JSON the same way import does for HTML, is that right?

I was grabbing the "Recent Posts" bit from the wiki pages because it's already properly formatted in HTML, so I can easily insert it in another page. Namely, the "Create Artist" page. Is it fine to use XMLHttpRequest or does it put pointless stress on the server or something?


Whatever works for you. Custom formatting it is likely a lot more flexible for you long run, and that means the raw json data is pretty powerful for you. if you really want to use the existing dom elements then that's also fine.


I'm not going to make any mass downloader or anything, just these tweaks. If I ever decide to release it, I'll ask you guys first.

Thank you very much for the attention!