Template talk:TTC station page

Latest comment: 2 years ago by Joeyconnick in topic Inconsistent TTC station urls

Inconsistent TTC station urls

edit

The new urls for TTC stations come in one of two formats with and without the -station suffix:

  1. https://www.ttc.ca/subway-stations/sheppard-west-station
  2. https://www.ttc.ca/subway-stations/york-university

Most station urls have the -station suffix. All urls now use dashes instead of underscores for multi-word names. The modified template now works for single-word station names. Could an appropriate if-statement be added to the template like an optional third parameter for style? Any suggestions? @Blaixx: Please comment. TheTrolleyPole (talk) 02:29, 16 December 2021 (UTC) @Joeyconnick: Please comment. TheTrolleyPole (talk) 02:36, 16 December 2021 (UTC)Reply

That's annoying. Option 1 would be to use a conditional, something like:
{{#if: {{{3|}}}
   | omit "-station" from URL
   | include "-station"
}}
Option 2 would be to modify the template so that the first parameter would have to explicitly include the word "station" i.e. {{TTC station page|sheppard-west-station|Sheppard West}} and {{TTC station page|york-university|York University}}
Option 3 would be to convert this template into one big lookup table, kinda like Template:TTC stations. BLAIXX 03:23, 16 December 2021 (UTC)Reply
I like something like option 1. However, York University appears to be the only one with an inconstant url format; thus, I will code it as an exception outside the template. I have converted the underscores to dashes in all other multi-word names on an article-by-article basis. TheTrolleyPole (talk) 18:42, 16 December 2021 (UTC)Reply
If that's the case, we could get it down to a single parameter for all other stations by piping the formatted version into some string formater templates. e.g.: {{replace|{{lc:Sheppard West}}| |-}} –> sheppard-west. Not worth the effort and complexity now that you've already changed all of them and that the URLs shouldn't change for another few years at least :) BLAIXX 03:25, 17 December 2021 (UTC)Reply
Yeah no, the proper approach is to check for the exceptions (at the moment only "York University", correct?) and render everything else as "/[station_name]-station". So that's Option 3, but it's not a "big lookup table" because there's only one exception that needs to be checked for... everything else follows the same consistent format. Basically we write "is the station 'York University' or is it anything else? —Joeyconnick (talk) 04:02, 21 December 2021 (UTC)Reply