27

In a SE site, if you put the link to a question, the link is parsed into the question's title. For example, https://meta.stackexchange.com/questions/246034 produces Is the loading icon copyrighted by Stack Exchange?.

But this does not work cross-sites.

Back at Programmers SE, I made a question that contains a link to another question in StackOverflow, but as you can see, the link is not parsed.

I think it would be nice if all SE sites were parsed - even cross-sites.

1
  • I am guessing since eight years have passed, there were other priorities or does it really cost that much processing power (more than holding images or processing LaTex)? Nov 21, 2023 at 23:53

1 Answer 1

5
+25

This would be a great feature to have the titles automatically added cross-site, but till then, I've made a userscript. It will convert the URL to its title (with a minor delay).

Here it is in action on your linked question:

GIF showing bare URL in post converted to post title

var sites = ['stackexchange', 'stackoverflow', 'superuser', 'serverfault', 'askubuntu', 'stackapps', 'mathoverflow', 'programmers', 'bitcoin'];

$('.post-text a').each(function () {
    var anchor = $(this);
    if (sites.indexOf($(this).attr('href').split('/')[2].split('.')[0]) > -1) { //if the link is to an SE site (not, for example, to google), do the necessary stuff
        var sitename = $(this).attr('href').split('/')[2].split('.')[0],
            id = $(this).attr('href').split('/')[4];

        $.getJSON("https://api.stackexchange.com/2.2/questions/" + id + "?order=desc&sort=activity&site=" + sitename, function (json) {
            anchor.html(json.items[0].title); //Get the title and add it in
        });
    }
});   

I've also added this to my SE Optional Features userscript.

2
  • Isn't that already applied in Stack Overflow? Mar 22, 2015 at 18:13
  • @PythonMaster what do you mean? auto-parsing cross-site links from SO? Do you have an example? If SE have this on SO, it should't be too hard to do it for all sites should it...? Mar 22, 2015 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .