23

I ran into a debate on question edits just now.

A question had 2 embedded links, in this format:

I had this [question][1] which...
<...>
And for the [other question][2],

  [1]: https://stackoverflow.com/questions/12345/a-readable-title-yadda-ya?noredirect=1#comment12345_67890
  [2]: https://stackoverflow.com/questions/54321/another-readable-title-yadda-ya

A user (A) edited said question, removing everything behind the question ID from the title:

  [1]: https://stackoverflow.com/questions/12345
  [2]: https://stackoverflow.com/questions/54321

Imho, that removes useful content from the question, as the titles can be seen when you hover over a link, so I rolled that back.

Apparently, that was not as straightforward, as the original editor (A) re-applied his edit, which I rolled back...
Then, another user (B) jumped in, told me the comment link in the first question link was "broken" (it linked to the question just fine), and rolled back my edits.

So, thinking "if the comment link is the issue, let's fix that", I edited the question:

  [1]: https://stackoverflow.com/questions/12345/a-readable-title-yadda-ya
  [2]: https://stackoverflow.com/questions/54321/another-readable-title-yadda-ya

That was rolled back again, following which user B just removed the whole markdown resulting in full-out titles in the middle of the OP's question:

I had this question (https://stackoverflow.com/questions/12345) which...
<...>
And for the other question (https://stackoverflow.com/questions/54321),

Sure, now the titles are readable, but also (imo) quite an eyesore...

So, what's a good practice?

Should titles be removed from markdown? Should they stay? Should we prefer automatically resolved titles regardless of layout?

5
  • 6
    I'd go with I had this question ([Other question title][1]) to make sure everything is obvious and readable directly in the question. Assuming no one changes the other question's title. After that I don't care about how the link is formatted. Commented Oct 17, 2023 at 19:07
  • 12
    These seem like quite useless edits if all you are doing is squabbling over the difference between two valid and usable link URLs.
    – Drew Reese
    Commented Oct 17, 2023 at 19:17
  • 1
    @user4581301: Putting titles of other questions in italics can be helpful to make it clear that the question isn't part of the sentence-structure of the place you're putting it. I often like to use the exact title of the question so people can recognize it as one they've already read. (Especially for a canonical that gets linked often.) If you just copy/paste a question URL into markdown directly, SO expands it to the question title as a link, so it saves a couple keystrokes when copy/pasting a URL, too. But for some cases Laurel's suggestion of rephrasing the title is good. Commented Oct 18, 2023 at 5:54
  • 4
    Imho, that removes useful content from the question, as the titles can be seen when you hover over a link - This is also my opinion. I would have rolled back the edits as well, regardless of whether the link text matched the title (as suggested in the answers.)
    – AJM
    Commented Oct 18, 2023 at 13:21
  • 3
    I dunno what specific justification the editors might have had since this is just presented theoretically, but one reason the users might do such an edit is because the titles of questions can and do change on occasion, and the title-in-the-url does not automatically update wherever is posted. The only thing that's relevant with regard to making the URL load correctly is the question number. It could be that OP finds it frustrating/confusing when clicking links and finding different titles (not saying I agree with such a URL-editing philosophy, just thinking of why someone might follow it).
    – TylerH
    Commented Oct 18, 2023 at 13:23

3 Answers 3

14

Question titles should be part of URLs so they show in the mouseover. I see no reason for editing to remove them unless the edit also needed space in the 30k char limit for other additions. (In which case they should use https://stackoverflow.com/q/12345, with q instead of questions).

An edit that just strips human-useful information out of URLs is the opposite of useful and should get flagged. I'd consider it vandalism, and don't want to see that happen to any other posts, my own or anyone else's. (If someone did this as part of a useful edit that wasn't close to the 30k limit, I'd comment and ask them not to do that in future. In your case with user A, where they went so far as to make another edit that only did that, raise a flag. Perhaps not if it's their own answer, but I'd still consider it in that case if they don't respond to a comment asking them not to do that.)


Question titles should preferably be in the formatted text of the question

Especially for titles that are somewhat recognizable ones that get linked frequently, so people reading your answer will know what you're linking if they've already read it. Such as Which types on a 64-bit computer are naturally atomic in gnu C and gnu C++? -- meaning they have atomic reads, and atomic writes which needs to get linked frequently to debunk the idea that there are any. (Although often just linked in comments, where the https://stackapps.com/questions/2378/se-comment-link-helper user-script automates replacement of URL with [title](url).) Other experts reading the answer who recognize the title will know they've already read it and hopefully upvoted it and its answers.

If you have multiple Q&As to link, a bullet list works well for a "see also" section or a set of related links you introduce with a paragraph. You can say something about why you're linking each one with text following the titles. Some examples of answers where I've done this include

  • Does hardware memory barrier make visibility of atomic operations faster in addition to providing necessary guarantees? (no).

  • When to use volatile with multi threading? (basically never in C++11) - it's a long answer with some bullet-lists of related links near the end, and various links to other Q&As pasted in other places. (Somewhat messily I have to admit; it could probably use some polishing.) In general I also followed the style of making the link text the title of the article I'm linking even for external links, such as Modern Microprocessors A 90-Minute Guide! which I find myself linking in a lot of answers.

  • This meta answer. :P Have a look at its markdown if you want. I also like to use full URLs (which clutters the markdown some but makes sure I can keep track of which URL is which when moving them around). I middle click the "share" link when I want to link to a specific answer. That opens a new tab with the URL bar having a #1234; from there I ctrl-L ctrl-C to copy the URL.

    And notice that for question titles that are yes/no questions, I like to include the yes/no answer, especially if a misconception is relatively common.

  • What does memory_order_consume really do? is one of many questions about C++11's consume and kill_dependency that were meant to expose the benefits of CPUs' dependency ordering of memory ops. But unfortunately there are a lot with similar titles, and I never remember which one's which when I'm looking for where I said what about the language feature vs. the CPU features. Same problem for several questions like Does hardware memory barrier make visibility of atomic operations faster in addition to providing necessary guarantees? (no).

    So the value of including the exact title of the question goes down in that case, where it's not unique and memorable.

    An interesting case is Is incrementing an int effectively atomic in specific cases? - it used to be titled Can num++ be atomic for an int num? and I still find the link by typing "num++" in my browser's address bar, which auto-completes the old title/URL. The new title is certainly better in terms of describing the question, but is no longer so unique / memorable. (This is a minor downside and I'm not even considering reverting it. I guess in future I'll have to start auto-completing on "incrementing")


Putting titles of other questions in italics can be helpful to make it clear that the title isn't part of the sentence-structure of the place you're inserting it.

If you just copy/paste a question URL into markdown directly, SO expands it to the question title as a link, so it saves a couple keystrokes when copy/pasting a URL, too. And when editing, you have a whole URL to move around, but it reminds you which link it goes to, unlike a ][2] fragment of markdown. (Because you used a full URL, not stripped down to just a number. That would make it easier to make mistakes like linking the same thing twice, or switching two URLs you meant to include in different places.)

But for some cases Laurel's suggestion of rephrasing the title to make it a natural part of a sentence is more appropriate. Especially for long titles like Why does mulss take only 3 cycles on Haswell, different from Agner's instruction tables? (Unrolling FP loops with multiple accumulators) that make a paragraph super messy. Ok in a bullet list, but in a paragraph I'd just recommend that people see my answer about unrolling with multiple accumulators.

2
  • (I don't expect everyone to fully agree with slapping sometimes-long titles into answers that want to link them. It's not appropriate for every writing style, or for every context. Partly this answer is justifying why I like to do it that way. The top section about the actual URLs is the part that answers this meta question, which I hope at least 99% of SO users would agree with.) Commented Oct 18, 2023 at 7:11
  • Alternatively one could provide just the q/# value in the URL and then add a tooltip separately for the title of the question.
    – TylerH
    Commented Oct 18, 2023 at 13:20
35

Fix the root problem: Accessibility

According to Princeton's Meaningful Links article:

Place the link on text that clearly and uniquely describes where the link goes.

Where does "question" lead? Where does "other question" lead? The link text has effectively narrowed down the scope from the entire internet to any one of 24 million different pages (and that's not even counting any non-SO "question" pages—they exist). That's still unacceptably broad.

Using the question title as the link text (as happens automatically when you put a SO non-deleted question URL in a post) is the easiest way to create a unique link text. (For best results, edit the question title so it doesn't suck before doing this.) You can also reword the title (or otherwise create a short summary of what you're linking to) so that it fits in the surrounding sentence, like if you wanted to talk about comparing the differences between "git pull" and "git fetch". And now, suddenly, it doesn't even matter that you don't know that the canonical URL slug is "what-is-the-difference-between-git-pull-and-git-fetch".

4
  • 8
    Well said. The only thing I would add is that sometimes the slug is useful for historical context, like if the linked question gets deleted or gets retitled.
    – wjandrea
    Commented Oct 17, 2023 at 16:10
  • Let me see if I am following this answer correctly. That example link that you posted there about the git question. If you edit this meta answer, the link is wrapped in some markup. But when you first created the answer, you just put a link there? The markup was added by the site itself?
    – Gimby
    Commented Oct 18, 2023 at 14:27
  • 1
    @Gimby No, the [link text](url) formatting is created either by pressing the add link button (and typing in both parts) or by constructing it manually. Automatic link conversion only happens with bare question URLS. If a URL will be automatically formatted, the preview for the post will show it as being formatted.
    – Laurel
    Commented Oct 18, 2023 at 14:36
  • @Laurel Then I got thrown off by "Using the question title as the link text (as happens automatically when you put a SO non-deleted question URL in a post) is the easiest way to create a unique link text.". I'm kind of relieved though, because until now I've always been doing that manually :) For a moment there I thought I was going to learn I had been doing it the hard way all this time.
    – Gimby
    Commented Oct 18, 2023 at 14:47
15

I do not see a reason to delete the title part if it is already in the link.

Making the hyperlinked text more accessible is fine but changing the link destination does not seem to improve anything. Unless a post really needs to save up characters which is very rarely the case.

You must log in to answer this question.

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