XF 2.1 Links to posts in the same forum are unfurling the wrong post - the first on the page

Stuart Wright

Well-known member
We have a problem where links to posts within our forum are unfurling to show show the first post on the page instead of the correct post.
They do, however, link to the correct post.

If I change the admin setting for the number of messages on the page (from the usual 25 to 26), the existing messages continue to show the original (wrong) post until I post a reply containing a link to a post in the same thread, at which time the existing unfurls change to show the new first post on the page (which is also the wrong post).

The same incorrect preview happens when using the unfurl test tool at /admin.php?tools/test-url-unfurling.

I've looked through our (many) addons and disabled the only one which I think could cause this and the problem still exists.
We use Cloudflare. I tested with that in development mode to bypass cache, but the problem still exists.
Any ideas on how to fix this, please?
Thanks
 
Last edited:
  • Like
Reactions: arn
This isn't really unexpected. Jumping to a post is really jumping to a particular location within a page. Unfurling works on a page basis, so what it's pulling in is what we report and that's based on the first post.
 
Thanks for the reply, Mike. So it's normal behaviour. That's disappointing because from a user's perspective, it's completely wrong information. A user would obviously expect to see the specific information relating to the post they are linking to.
I'll add it as a suggestion, though I feel it's actually closer to a bug.
Thanks.
 
@Stuart Wright there is a workaround that I occasionally use on my own site but it requires 1) linking to a post using a /posts/[post-id]/show URL and 2) editing the post template to include a meta description (post snippet) and more appropriate page title. The title format I use is "Post #[post.position] in [thread.title]". Without the template edit, the unfurled URL information is very generic. For example, your post:

With the template edit, it should be something more like what's shown in this attachment:
xenforo-2-1-single-post-unfurled-example-with-template-edit-workaround.gif

The problem with this workaround is that even if the post URL is used, when someone does click on the unfurled URL, they won't see any other posts in the thread.
 
Apologies for bringing this back - @Mike

....unles they then proceed to click on the post number top right, I guess.

Seems I remember clicking on the post number would open the target post on its own page with a single post.
(am i wrong?)



As an example from my site:

Code:
https://www.mtbnj.com/forum/threads/january-2022-outside-pic-photo-contest.53361/post-1114254

Is the link associated with the post number on the top/right of the page -

It now redirects to a place on a page.

Code:
https://www.mtbnj.com/forum/threads/january-2022-outside-pic-photo-contest.53361/page-4#post-1114254

When asking to UNFURL - it would seem the first behavior of unfurling the post would be appropriate
When following the link, it seems the second is correct.

Not sure if this is possible cause I don't know the mechanics.
 
Back
Top Bottom