28

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

6
  • 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
    Commented Oct 2, 2011 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
    Commented Oct 2, 2011 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
    Commented Oct 2, 2011 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
    Commented Oct 2, 2011 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
    Commented Oct 2, 2011 at 11:35
  • Ah, already reported as a bug: Question links stop getting converted to title-based links.
    – Arjan
    Commented Oct 2, 2011 at 15:42

2 Answers 2

30

You had to ask – well, here goes.

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 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 200 on meta sites (was 40 at the time this question was asked) 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 (currently none), 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 Exchange, all sites work.
    • d) On all meta sites, links to Meta Stack Exchange work.
    • e) Anything else does not work.
  4. For the purpose of 2 (in contrast to 1 and 3a), facebook.SO and SO were 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.

8
  • 1
    Would support for referrals to answers be added too? (Though I dislike such short URLs, but that's another story.)
    – Arjan
    Commented Nov 29, 2011 at 21:02
  • 2
    see @arjan 's comment, we never updated this to work with the shortened answer links. Commented Apr 5, 2012 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
    Commented Apr 21, 2014 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
    Commented Jul 29, 2014 at 20:55
  • @Troyen Yes, they are.
    – balpha StaffMod
    Commented Jul 30, 2014 at 4:57
  • @balpha is there still FB.so sub site? I was about to edit it out, but not 100% sure. Commented Mar 16, 2016 at 9:37
  • Thanks @Meta, though I had to leave some of it so that the answer would make sense as the question mentioned the dead fb.SO site explicitly. Commented Apr 27, 2016 at 5:51
  • Can this maybe be updated to work with /a/ links now?
    – Jason C
    Commented May 6, 2017 at 22:38
18

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 the post that links to it 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:

      Raw links on Super User

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:

8
  • 7
    you are fairly authoritative in my book... your answers are often more correct than mine! Commented Oct 2, 2011 at 16:03
  • Thanks arjan, +1. switched to bug
    – genesis
    Commented Oct 4, 2011 at 5:35
  • 2
    @genesis-φ, I already posted a link to an existing bug report!
    – Arjan
    Commented Oct 4, 2011 at 5:38
  • 1
    Just proved myself right, @Jeff; this already needed an edit! ;-)
    – Arjan
    Commented Oct 4, 2011 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
    Commented Oct 4, 2011 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
    Commented Oct 4, 2011 at 17:19
  • 1
    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
    Commented Oct 4, 2011 at 17:22
  • Just to clarify: unless that post is edited and saved too. Does "that post" refer to the post being pointed to, or the post doing the pointing? Commented Mar 16, 2016 at 5:55

You must log in to answer this question.

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