50

It often happens that people will refer to other questions by simply pasting the full link to this question, especially on Meta.

Would it be a good idea to detect such links, and replace them directly by a formatted link on their current title?

Example:

 You can try formatting at this
 question:
 https://meta.stackexchange.com/questions/49424/stack-exchange-sandbox

Would be automatically changed in:

You can try formatting at this question: Stack Exchange Sandbox

It would make links given by new users (unaware of the full syntax) more elegant, and it would also be faster when more regular (and lazy) users want to point to another question without making the usual "see it at this other place"


Edit: Note that this behaviour is implemented already for the "possible duplicate" auto comments, so the question here is not about "how to do this technically".

11
  • 4
    Would be problematic for questions like meta.stackexchange.com/questions/45046 unless we included some manner of truncation (and then, how would we decide how long it should be?)
    – Grace Note StaffMod
    Commented May 10, 2010 at 14:57
  • 4
    Question titles change, would you want them to be updated or not? would you like the "closed" of a closed question to be included or not?
    – juan
    Commented May 10, 2010 at 14:58
  • 2
    @Downvoter - it's only an help on the moment the message is posted, so only with the current title. No need to update it further. About the closed, not sure, it doesn't bring a lot of information at this point, only noise, probably.
    – Gnoupi
    Commented May 10, 2010 at 15:12
  • 2
    @ccornet - the new limit of 150 chars makes it already more "presentable". Either way, most of time the copied link contains already a long part of the title. So not much difference in this case.
    – Gnoupi
    Commented May 10, 2010 at 15:14
  • 1
    @Gnoupi I never caught the update on the title character limits. Thanks!
    – Grace Note StaffMod
    Commented May 10, 2010 at 15:17
  • 4
    Adding a bounty. Please please implement this. It is so annoying to have to copy over the question title and link it
    – Pekka
    Commented Nov 3, 2010 at 11:10
  • See also: meta.stackexchange.com/questions/1010/advanced-syntax-ideas/… Commented Dec 11, 2010 at 14:45
  • Adding another bounty. This is SOOOO annoying and doesn't deserve the status-completed tag yet
    – Pekka
    Commented Jan 31, 2011 at 12:00
  • 4
    I created a feature request to implement this functionality in comments: meta.stackexchange.com/questions/77394/…
    – Alex B
    Commented Feb 1, 2011 at 18:29
  • The request is not fully completed, it is still not completed for comments meta.stackexchange.com/questions/77394/… Commented Feb 11, 2023 at 5:05

6 Answers 6

19

For intra-site links (like, SO -> SO) this is now supported.

https://meta.stackexchange.com/questions/49424/stack-exchange-sandbox

becomes*

Stack Exchange Data Explorer

Like with tag rewrites this is done on post submission and is not currently reflected in the editor preview. It will always insert the current title into the post, at post creation time. However, should the title subsequently change it will not be updated unless the post is edited.

*Note that although the old title of the question is in the link, the new one is inserted.

10
  • Awesome! Is this triggered on edit? Will it be rolled out to the stack exchange sites?
    – Alex B
    Commented Nov 5, 2010 at 6:00
  • 2
    @Alex - it is triggered on edit, and will be available on all of the SE sites within the hour. Commented Nov 5, 2010 at 6:00
  • 6
    Would you consider adding this for inter-SE links too? Commented Nov 8, 2010 at 12:28
  • 9
    @Kevin: Could you add this to comments? meta.stackexchange.com/questions/49424/stack-exchange-sandbox
    – Gnome
    Commented Nov 9, 2010 at 20:48
  • 2
    @Arjan - it will always insert the current title into the post, at post creation time. However, should the title subsequently change it will not be updated unless the post is edited. Commented Dec 13, 2010 at 7:33
  • I guess it's by design that the Markdown <bare url> syntax gets one the title too? (If not: currently the <..> syntax also is replaced by the title.)
    – Arjan
    Commented Dec 13, 2010 at 10:30
  • 1
    This doesn't seem to always work though. Are there some special rules? And it definitely doesn't work in comments.
    – Pekka
    Commented Jan 31, 2011 at 12:01
  • Sometimes it works too well: sometimes even links in code blocks are changed, and also links that are explicitly linked manually to avoid replacement (like in revision 1 and 2 here).
    – Arjan
    Commented Jan 31, 2011 at 12:13
  • Now that this post is on MSE but the link still refers to MSO, editing this very post seems to break the auto-linking, while a bare URL on MSO pointing to MSE works just fine: maybe auto-linking on MSE should also support links to other metas? And curious, @Kevin: the revision history of this very post currently shows the bare link. Does that imply that the HTML is rendered on the fly for the revision history?
    – Arjan
    Commented Apr 20, 2014 at 15:20
  • 1
    Ah, it seems that redirections are not handled, at least not in the preview: linking from MSE to MSO, and the other way around, still works when referring to new posts, just not so much for migrated posts. Like meta.stackoverflow.com/questions/49424/stack-exchange-data-explorer which currently redirects to meta.stackexchange.com/questions/49424/stack-exchange-data-explorer and is not rewritten with its old URL (at least not in the preview).
    – Arjan
    Commented Apr 21, 2014 at 7:18
6
+500

I like this idea a lot, it would save me from having to generate links the "right" way and I do think it would make the site a lot cleaner. I think it would also make comments much more elegant. I do, however, fear that it might be a pain to implement. (Not sure about that, really depends a lot on how the backend works. As Brandon pointed out, it might not be that difficult after all.)

EDIT: this is now supported:

Replace trilogy raw links with the current question title?

AWESOME!

8
  • 2
    I don't think it'd be hard to implement, they've already done it with the close as exact duplicate function.
    – Brandon
    Commented May 10, 2010 at 15:03
  • That's an excellent point. Commented May 10, 2010 at 15:04
  • 2
    @Brandon It's slightly different. Closing links are generated as part of the closing function, so the function can choose to format it as it likes. This proposal would be parsing actual post content and editing it.
    – Grace Note StaffMod
    Commented May 10, 2010 at 15:08
  • 2
    @ccornet - duplicated links are inserted in the actual post content as well.
    – Gnoupi
    Commented May 10, 2010 at 15:12
  • 3
    @Gnoupi But they're inserted. They aren't edited from existing links. Still feasible, but it's inaccurate to say it's the same.
    – Grace Note StaffMod
    Commented May 10, 2010 at 15:16
  • @ccornet, you are absolutely right, I didn't consider the fact that one is automatic.
    – Brandon
    Commented May 10, 2010 at 15:22
  • 4
    @ccornet: Amazon links are already automatically rewritten. Doesn't this imply that parsing and editing of content already takes place? Commented May 10, 2010 at 15:24
  • 1
    @ire I will concede that the functionality already exists (I never claimed it wasn't). But that's not part of the duplicate question linking functionality.
    – Grace Note StaffMod
    Commented May 10, 2010 at 15:26
3

To indicate that this is an automated link and more importantly to which SE-site it links, a small logo could be placed next to the question title

edit feature-requested

0
3
+250

Could we not add a new button to the Toolbar - link to SE question.

alt text

This could open a popup where you

  • Select the site that the question is on (drop down?)

    • Then search for the question to link to (similar to how the Title textbox works when asking a new question.)

      Or

    • Enter the question number to link to.

The popup validates that it is a valid question and then inserts the nice formatted link in to your answer/question for you.

I think it should handle multiple inserts elegantly too. By that I mean it should take care of the " see here, here, here and here " type of linking.

EDIT

Pekka's comment on this has just got me thinking about this.

The process for selecting links could be shortened somewhat by simply getting the user to enter the question/answer id. If one question or answer is found then it would simply add the nicely formatted link in. If there is more than one ID e.g. exists in more than one site then user selected which one they want and it adds in.

Another way to do this would be to enable some kind of shortcut pattern which is converted to a nice link when posted. The shortcut pattern could be a site ID and then Q/A ID.

Entering [SO:9033] in a post would be transformed to Hidden Features of C#? when posted.

Using 2-3 characters for the site code should be plenty enough to allow for existing sites and new sites.

3
  • 5
    this seems awfully complex compared to "paste link" Commented Nov 5, 2010 at 7:50
  • @Jeff how about making that work then?
    – Pekka
    Commented Jan 31, 2011 at 17:34
  • @Pekka - I just added a couple more ideas in to my answer :) Commented Jan 31, 2011 at 19:10
3

It was not working in this intra-site example:

Enter image description here

If you click the above link you will see that the titles are now rendering correctly, but only because we edited the post to use much longer links, which are not the URLs we get from clicking the "share" button.

This also means that my userID of "5" is not included anywhere any more, and therefore I won't get the "announcer" badge when 25 people click one of the links.

3
  • @Luuklag What do you mean? Commented Jan 9, 2021 at 0:18
  • You wont get the badge for directing within the site anyways IIRC.
    – Luuklag
    Commented Jan 9, 2021 at 7:36
  • Links to answers aren't automatically converted to include the question title. Only links to questions are, for both the shortened form of the URL (with or without the /userid portion at the end) and the full URL.
    – V2Blast StaffMod
    Commented Jan 10, 2022 at 17:26
1

I like this idea.

However, there is a problem with punctuation and capitalization.

C++ Beginner - Trouble using classes inside of classes

would probably end up looking like

c beginner trouble using classes inside of classes

Which, as you can see, kind of changes what the question is about (C++ to c). This would be a problem unless you were committing to do a DB lookup every time a link is typed in/submitted in a comment or answer, in order to the get the correctly cased and punctuated title. Those lookups may add up (look at how many links I used in this post alone, so isn't necessarily a good idea in terms of performance. Although, Jeff might just want to throw some hardware at it.

Simple Spec

All links of the format

"http://[((meta.)?stackoverflow|superuser|serverfault).com/questions/[\d]/ < QuestionTitle>"

(Could somebody fix my regex, I'm rusty)

would automatically be converted to

< QuestionTitle>

Or, if the question title is too long

vb net how to require checkedlistbox... or VB.NET: how to require CheckedListBo...

This would only be done once, at the time that the comment or question is initially linked. If the title of the question changes, the comment text would not change, because the link itself has not changed.

This magical replacement does not apply to people who are linking directly to answers, edit pages, or specific revisions. It could theoretically work for user pages, or tag pages.

Second option

A second alternate implementation would be to green jagged underline the link (like a grammar error), and have a rollover click option that says "convert to title hyperlink" or some such text. This would do the conversion that I described earlier, except that it would be optional. Further, because it would be replacing the text before the user has submitted the comment, it shows them how to do linking correctly (which they might not now) and it gives them the chance to change how it will appear. This is almost ALWAYS better than any "autocorrect" options. I hate autocorrect.

The (rather large) downside is that this would be more difficult to implement than a straight Regex replace.

5
  • 3
    Do close-question comments/links have that same punctuation/capitalization problem? If not, then we could mesh the title-fetching nature of those links instead of using the raw URL's title text. This would also allow people to post raw links with just the ID and benefit from this system (as sometimes occurs).
    – Grace Note StaffMod
    Commented May 10, 2010 at 15:50
  • 1
    @ccornet I believe you are correct. The performance implications would not be very severe
    – devinb
    Commented May 10, 2010 at 16:18
  • what's do bad about a db lookup every time a link is typed in/submitted in a comment or answer? Commented Aug 4, 2010 at 12:49
  • @Ian, I suppose doing a lookup on post wouldn't be so bad. But doing it on every typed link would be terrible. We shouldn't be firing of possibly limitless db pings. It would easily open up for a malicious Denial of Service attack, even an accidental one.
    – devinb
    Commented Aug 4, 2010 at 13:05
  • How do you think the reputation is reported? I don't think they rewrite an HTML page everytime to record the rep on a certain page. There are DB Requests going on all over the place. That's what makes the site nice and dynamic. I don't follow your logic. Commented Aug 27, 2010 at 20:55

You must log in to answer this question.

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