# What limitations does converting question links to links with titles have?

On this question there are more than 50 links to Stack Overflow questions. However, the last 6 links aren't converted to titles (http://facebook.stackoverflow.com/questions/6530420/control-the-image-that-facebook-shows-when-i-like-a-url should be converted to http://facebook.stackoverflow.com/questions/6530420/control-the-image-that-facebook-shows-when-i-like-a-url).

However: changing all http://facebook.stackoverflow.com/... into http://stackoverflow.com/... fixes this, both in the preview and the final result. Also, the preview won't show any title for http://facebook.stackoverflow.com/... links.

My question is, what limitations does this converting have? How are these question titles retreived? Via API? Through database?

I'm not sure about title, feel free to edit that

-
In earlier revisions of that questions, some links in the middle of that list failed too; I guessed it was just caused by using <s> erroneously (to strike out fixed questions). In the current revision, the preview shows no titles at all; I guess that's still due to the <s>? –  Arjan Oct 2 '11 at 11:06
@Arjan: I have edited all these strikes so it's not broken anymore. They were in front of link. I have moved link to another line and it's okay now –  genesis Oct 2 '11 at 11:07
Ah, the preview does not like the facebook subdomain. Removing that fixes it, in the preview, though maybe not for more than 50 links. –  Arjan Oct 2 '11 at 11:10
@Arjan: yes, removing facebook fixed it. However I'll keep there that broken one, so this question don't miss its point –  genesis Oct 2 '11 at 11:12
@Arjan: The problem is, I do not see any ajax requests and links are already titles when reloading page. It seems to be backend doing it (Server side) –  genesis Oct 2 '11 at 11:35
Ah, already reported as a bug: Question links stop getting converted to title-based links. –  Arjan Oct 2 '11 at 15:42

The restrictions are currently as follows, but note that they do look a bit contrived, resulting from the fact that they have grown over time (from single site to cross-site, from "there are no subsites" to "facebook.SO", etc.), so it's not unlikely that we'll revisit them.

1. Links to questions on the same site (or the master site / sub site, i.e. from SO to facebook.SO and the other way around) are unlimited.
2. Links to other sites are limited to
• a) 5 linked-to sites and
• b) N questions per target site, where N is 40 on meta sites and 10 on non-metas (this is about the site that the post containing the link is posted on, not the site that is being linked to)
3. While same-site links always work, which other sites work depends on where you're posting:
• a) On all subsites (which is currently only fb.so), links to the master site work, and vice versa.
• b) On all meta sites, links to the corresponding main site work, and vice versa.
• c) On Meta Stack Overflow, all sites work.
• d) On all meta sites, links to Meta Stack Overflow work.
• e) Anything else does not work.
4. For the purpose of 2 (in contrast to 1 and 3a), facebook.SO and SO are considered separate sites.

The reason that removing the facebook. part from links caused the auto-title to suddenly work, as you observed, is 2b in combination with 4: forty links to fb.so work; the 41st doesn't.

Point 4 is also the rule that makes the least sense, so don't expect that to stick around forever.

This will also work identical in the preview from the next build on, with the exception of 2a. That one is only applicable to Meta SO anyway (because of 3), it's non-trivial to add to the preview because of slight differences in the implementation, and it's a pathology to begin with.

To answer your other question in addition to what Arjan said: on the server-side, same-site links are retrieved from the database, cross-site links use an HTTP API. The latter used to happen via cross-DB queries, but this was dropped at some point, because having multiple database connections lying around is just crying for issues.

-
Would support for referrals to answers be added too? (Though I dislike such short URLs, but that's another story.) –  Arjan Nov 29 '11 at 21:02
see @arjan 's comment, we never updated this to work with the shortened answer links. –  Jeff Atwood Apr 5 '12 at 23:14
(It seems that rewriting of old migrated MSO URLs does not currently work, at least not in the preview; see my two comments on Kevin's answer here.) –  Arjan Apr 21 '14 at 7:23
Are links to deleted questions excluded? I edited a post where the title was properly displayed and suddenly the raw link was showing. The question it linked to was deleted between the original posting and my edit. –  Troyen Jul 29 '14 at 20:55
@Troyen Yes, they are. –  balpha Jul 30 '14 at 4:57

I'm not an authoritative source, but:

• While editing, Ajax calls to the API are used to fetch the data that is needed to change raw links into clickable links with their title.

• When saving, the HTML is "pre-cooked" (including sanitation and tag-balancing) from the Markdown source. This includes creating the clickable links, just like it includes creating <img> elements and so on. So, upon loading the page, the HTML fragment is simply fetched from a database or something like that. This implies that changes in a title are not visible in a post that links to it, unless that post is edited and saved too. (That applies to tags too.)

From this very Meta, this seems to work for links to all Stack Exchange sites: Why did my "goat cheese espuma" flop? But some titles might look odd, lacking MathJax on the linking site: Integrating $\int \frac{1}{1+e^x} dx$.

On other sites (and their Metas) it seems only links to that specific site work:

Bugs aside, there shouldn't be any other limitations. Apparently the facebook.stackoverflow.com subdomain causes some issues in your example (which you already tested works fine when removing that subdomain). That is a bug.

Like:

-
you are fairly authoritative in my book... your answers are often more correct than mine! –  Jeff Atwood Oct 2 '11 at 16:03
Thanks arjan, +1. switched to bug –  genesis Oct 4 '11 at 5:35
@genesis-φ, I already posted a link to an existing bug report! –  Arjan Oct 4 '11 at 5:38
Just proved myself right, @Jeff; this already needed an edit! ;-) –  Arjan Oct 4 '11 at 16:52
Yeah, somehow I forgot that Meta was the special case because it was reasonably likely that Meta might link to any of the other sites, whoops. Interesting that metas don't auto-convert Meta links, though. –  Tim Stone Oct 4 '11 at 17:15
@Tim, on Meta Super User, links to both Super User and its Meta work just fine, if that's what you're referring to. Links to other network sites: apparently not. (Not even from Meta SU to Meta SO; ahh, I guess that's what you're referring to.) –  Arjan Oct 4 '11 at 17:19
I meant meta.* -> Meta Stack Overflow doesn't auto-convert, yeah. The other paths don't auto-convert bydesign because cross-site links except on Meta or per-site metas to their main site weren't considered common usecases, I seem to vaguely recall, but the meta.* -> Meta path would probably make more sense. –  Tim Stone Oct 4 '11 at 17:22