22

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.

2
+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 it's title (with a minor delay).

Here it is in action on your linked question:

enter image description here

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.

  • Isn't that already applied in Stack Overflow? – Anthony Pham Mar 22 '15 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 '15 at 18:38

You must log in to answer this question.

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