XF 2.2 Disable automatic link shortening with ellipsis/periods/dots? URLs displayed with dots will be broken when copy-pasted.

MaximilianKohler

Active member
On my forum, Xenforo is automatically converting the display of links from
https://www.bostonglobe.com/ideas/2019/03/15/america-becoming-doctor-can-prove-fatal/u3x4xfPC9VR2zSCnKArgYM/story.html
to
https://www.bostonglobe.com/ideas/2...prove-fatal/u3x4xfPC9VR2zSCnKArgYM/story.html

So if you're copying the whole text of a post, along with its links, then none of the links will work.


test https://www.bostonglobe.com/ideas/2...prove-fatal/u3x4xfPC9VR2zSCnKArgYM/story.html
Yeah, looks like this forum does it too.

EDIT: Ah! Not sure if this is the "correct" fix, but I figured out that if you put {url} in /admin.php?options/groups/seo/ -> Convert URLs to page titles that fixes it.

Good thing I caught this early, because you have to go back and manually change every link that got automatically shortened...

EDIT 2: Wow, this is super buggy. In new posts it seems to work, but even after editing the older posts it reverts back to the dots...

Hmm, maybe it doesn't work, or there's some x number of links that if a post contains it will automatically trigger it.

Neither {url} nor {title} | {url} are "fixes". But they may change the behavior slightly.

Note: When you click "edit" on your post it shows the link as normal. So that's a clue that it's only displaying as shortened; nothing permanent is being changed. That makes me wonder if there's something in the CSS that could be changed.

I'm on CentOS 7 and trying to use grep -r "Shorten_URL" /home/nginx/domains/forum.mysite.com/public/src/XF to find that phrase in all files in that directory but nothing happens.

Ah I found it with this: grep -rinw "shortenUrl" /home/nginx/domains/forum.mysite.com/public/src/XF

Code:
/home/nginx/domains/myforum.com/public/src/XF/BbCode/Renderer/EditorHtml.php:253:                $options['shortenUrl'] = false;
/home/nginx/domains/myforum.com/public/src/XF/BbCode/Renderer/SimpleHtml.php:101:                $options['shortenUrl'] = false;
/home/nginx/domains/myforum.com/public/src/XF/BbCode/Renderer/Html.php:228:                      'shortenUrl' => true,
/home/nginx/domains/myforum.com/public/src/XF/BbCode/Renderer/Html.php:1472:             if (!empty($options['shortenUrl']))

public/src/XF/BbCode/Renderer/Html.php seems to be the culprit.

That did it!!!! What a relief. Just change 'shortenUrl' => true, to false and it changes the display of all links to their normal state (removes all ...). No need to go back and manually edit any links.

If you don't want to disable it completely, but just want to modify the behavior you can mess with
Html.php:1472: if (!empty($options['shortenUrl'])).
 
Last edited:
Top Bottom