Template talk:LinkForumThread

From LifeWiki
Revision as of 23:12, 27 July 2017 by Apple Bottom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

It ends up being kind of time-consuming, picking apart the forum URL and putting all the numbers in the right places to make one of these links work. And when it doesn't work it can be rather mysterious, as muzik discovered today.

Would it be evil to have an option to leave all the URL parameters in one chunk, e.g.,

|f     = 7&t=2036&p=46748#p46748

... and maybe not have the standard be to name the link with the post ID, so that that number doesn't have to be copied to two more places?

Probably I'm just being lazy. I might need a reminder of why I shouldn't just throw in regular URL links to forum postings wherever I feel like it... Dvgrn (talk) 14:31, 24 July 2017 (UTC)

You can well use good ol' URLs! I prefer these templates for four reasons:
  1. they're neater;
  2. they lead to more consistent formatting of references and links;
  3. they allow tracking pages linking to various external sites; and
  4. they allow for easy updating in one place only if the forums ever move.
Of course plain URLs and hand-crafted links are still fine. As for passing all the parameters in one batch, the main reason is MediaWiki's parser. Taking a look at
|f     = 7&t=2036&p=46748#p46748
the first equal sign indicates a named template parameter, but the subsequent ones are supposed to be passed as literals. I don't recall whether this is a problem with named parameters off the top of my head, but it very much is with unnamed ones and requires escaping the latter equal signs there, which is typically done using a special template, Template:=, similar to Template:!. So you might have to write
|f     = 7&t{{=}}2036&p{{=}}46748#p46748
instead, which isn't much of an improvement: you still can't directly copy and paste from the URL, and it's pretty opaque and confusing for any user who's not familiar with the finer points of MediaWiki's parser.
In any case I've edited the template to recognize p= even in the absence of f=. (It really should've done that all along; apologies for the oversight.)
ADDENDUM — just between you and me, I do confess these templates are a bit messy; I'm much bigger on doing what's needed to get the job at hand done than I am on good, well-thought out design. I'll add "saner templates" to my equally messy list of things to eventually (hopefully) take care of.
--Apple Bottom (talk) 09:49, 27 July 2017 (UTC)
Okay, let's try it:
Now it's just one number to remember, and it's the one that's obviously required for a post link. That seems like progress! I'll be trying to use this template in the future. It also allows post links that are short enough not to overflow a standard line of RLE, which probably doesn't matter at all but has been obscurely bothering me anyway. Dvgrn (talk) 11:19, 27 July 2017 (UTC)
Huh, that's strange. The actual template links work, but when I try to use the reported URL, the same old problem comes back -- the browser just ends up at the top of the page. What am I missing here? Dvgrn (talk) 12:31, 27 July 2017 (UTC)
I'm not sure. What do you mean when you say "when I try to use the reported URL"? In particular, which URL isn't working? I've tried both links -- for later reference in case the template changes, that's this and this --, and they both work for me, taking you to the right page and scrolling down the page to the right post.
If you're having trouble perhaps your browser's adding something to the fragment link (the #p46748 bit), say a trailing comma; if the fragment in the URL doesn't match the one in the page's code exactly, the browser will ignore it. That's the only thing I can think of right now. -- Apple Bottom (talk) 23:12, 27 July 2017 (UTC)