Onebox for same site not working

AI-generated summary

In a support thread titled “Onebox for same site not working,” nicop91 reports that pasting a link to another topic on the same Discourse instance no longer generates a onebox—only the raw URL appears. pfaffman notes that oneboxing still works if the URL is pasted on its own line, though it may show the title instead of a preview. nicop91 clarifies that the issue persists on their site regardless. pfaffman suggests sharing the site URL and version for debugging. nicop91 later resolves the issue: they had been omitting the topic ID from the URL (keeping only the post ID), which works for navigation due to server-side redirection but breaks oneboxing, as onebox doesn’t follow redirects. jomaxro explains that URLs typically contain two IDs—the topic ID (required) and post ID (optional)—and warns against removing the topic ID. nicop91 confirms that while the link still functions via redirect, onebox fails because it doesn’t follow redirects, which is expected behavior. The issue was user error: oneboxing requires the full URL including the topic ID.

Hello !

I see that copy / pasting a link to the same discourse (to another topic) does not display onebox anymore… Just the link.
Would you have an idea why / what I can do ? I don’t really know how to debug this…

Thank you

It wasn’t decided that the title is better, like Change the maximum attachment/upload size but if you paste on a line by itself you still get a onebox. Like

https://meta.discourse.org/t/changing-max-attachment-size/26435/19

On my discourse, the URL is not replaced (neither by title nor window)…

I think I might have seen that on a site I’ve worked with too. Can you share your URL? What version are you running?

My bad ! I was pasting the URL of a topic removing the IDs at the end of the URL (I wanted to send to the topic itself, not to a specific message).
With the full URL it works ^^

Thank you !

https://meta.discourse.org/t/onebox-for-same-site-not-working/71321/4

For reference, there are 2 IDs in most URLs. The first is the topic ID, the second is the post ID. It is safe to change/remove the post ID, it is not safe to remove the topic ID.

Well, the link still works without the topic ID (that’s what got me !) as it redirects you to the URL with this ID. But it does not work for onebox, which does not follow the redirection (which is normal ^^)