Template talk:VanguardFundURL

Currently generating invalid URLs
As of June 10, 2023, this template seems to no longer generate URLs linking to specific Vanguard funds, but (apparently, and confusingly) either something random or perhaps whatever fund you last visited at their site. Vanguard have changed the way their web site operates. From some experimentation, it appears that it may no longer be possible to properly access fund pages directly by fund number (0585) at all, but now only by fund ID (VTSAX), for example https://investor.vanguard.com/investment-products/mutual-funds/profile/vtsax.

Because of page protections ("This page has been protected from editing because it is transcluded in ..."), I cannot edit or otherwise fix this template. --TedSwippet 07:36, 10 June 2023 (UTC)


 * I concur that Vanguard has abandoned fund parameters in their URL. Redirects are either not implemented or broken. Fortunately, we only use this template in Template:Fund sidebar.


 * The cleanest fix is to simply remove the this template from use in Template:Fund sidebar. The template will still be useful, but without a link to the Vanguard site.


 * I have removed the active code from this template, from Template:Fund sidebar, and have revised the supporting documentation pages. We should consider deleting this template. --LadyGeek 23:53, 10 June 2023 (UTC)

Proposed deletion
I have proposed this template for deletion. If this is acceptable, --LadyGeek 00:04, 11 June 2023 (UTC)
 * The above section should be copied to Template talk:Fund sidebar
 * Link to the above new section from Talk:Vanguard fund info


 * Let's hold off on the proposed deletion until we're sure that it's not needed. See: Talk:Vanguard fund info --LadyGeek 18:17, 14 June 2023 (UTC)
 * Relevant discussion moved below. --LadyGeek 16:52, 16 June 2023 (UTC)

Vanguard fund links are no longer reliable
Discussion from Talk:Vanguard fund info moved to this page, which is more appropriate. --LadyGeek 16:52, 16 June 2023 (UTC)

--

As of June 10, 2023, Vanguard appears to have changed the way its web site operates, so that links to specific funds by fund number no longer work reliably and consistently. For more, see: Template talk:VanguardFundURL. --TedSwippet 07:50, 10 June 2023 (UTC)


 * The discussion is continued here: Template talk:VanguardFundURL --LadyGeek 23:56, 10 June 2023 (UTC)


 * Thanks for the fix. Template:VanguardFundURL could be augmented to map fund numbers to fund tickers, but it is fiddly, so deleting the template altogether seems reasonable.


 * However, many other wiki articles explicitly, directly and literally use the style of link that was generated by this template -- ...snapshot?FundId= &FundIntExt=INT -- and all of these may now be similarly vulnerable and unreliable. For example, this article alone uses it in 253 links. It should probably switch these to style as .../mutual-funds/profile/ instead.


 * A wider wiki edit seems motivated. Unfortunately, the wiki's standard search facility is not up to the job of identifying everywhere this style of link appears; so far I have been unable to adequately gauge the scale of the problem. --TedSwippet 08:14, 14 June 2023 (UTC)


 * Extension:Replace Text (admin access only) shows that the string  is found on 191 pages and many pages have more than one occurrence.


 * For editors, it should be possible that a list can be found with a MediaWiki API text search (the extension is a text search). API sandbox


 * Vanguard's old site Vanguard - Prospectuses contains a mapping of the fund number to name. This information is not present in the new website. Note that the links are broken on Vanguard's old website as well. Clicking on the link goes to a random fund - each with a fund number of 100(!).


 * There's a possibility that Template:VanguardFundURL could be useful in some new capacity. It's probably best to keep the template until we're sure it's not needed. Worst-case is to do a tedious manual edit. --LadyGeek 18:07, 14 June 2023 (UTC)


 * Sounds like we could be looking at around 500 occurrences of this style of Vanguard URL. That's a lot of manual editing. Instead then, how about this as a possible framework for a fix?
 * Rewrite Template:VanguardFundURL (or a new template; doesn't matter) to accept either a fund number (four digits) or a fund ticker (five alphabetic characters).
 * If numeric, map to a fund ticker (big parser #switch statement?).
 * Then for all cases, generate a new-style Vanguard fund URL based on ticker.
 * Finally, execute a bulk replace of something like https?://personal.vanguard.com/us/funds/snapshot?FundId=(\d*)[^ ]* with (guessing on the regex's here).


 * Coding the mapping from fund numbers to tickers is tedious but straightforward. The bulk replacement of hard-coded Vanguard URLs with calls to the template is the fiddliest part, since getting the regex's right will be critical to success (defined as minimal to zero manual fixup required later on!).


 * As a bonus, once we have all these URLs going through a single template, it will be a lot easier to cope with any Vanguard site URL changes of this nature in future. Also, open choice of either fund number or fund ticker for users. Thoughts? --TedSwippet 19:37, 14 June 2023 (UTC)

Verification will be tricky, as the URL will redirect on Vanguard's side to some landing page and won't return an error code. The link will always be good.

I managed to coerce Special:LinkSearch to find the broken links. It needs to be entered as a URL, not partial text. has 825 occurrences. Hence, my concern to tread very, very carefully. --LadyGeek 23:31, 14 June 2023 (UTC)


 * We can verify the fund numbers and tickers passed to the template directly. We know what they are, so all we need is a large lookup table, and if we find something in it then we know for certain that we are creating a valid URL. For cases where we don't find an entry, and Vanguard will redirect the generated URL (randomly?), the template can place the page in (say) "Category:Vanguard url error" which we can then clean up manually.


 * Having 825 broken (actually worse, they're misleading) URLs spread across our entire wiki isn't healthy. I think we can do better. I'll prototype a new and improved Template:VanguardFundURL to kick off. Once we have that, with 253 occurrences, Vanguard fund info itself provides a good initial test-case. Do you have a 'play' BH wiki instance on which you can test bulk regex replacement more widely?


 * (As an aside, Vanguard fund info is generated from a spreadsheet. Arguably we shouldn't be editing URLs in this page at all, but rather we should be fixing the underlying spreadsheet. But that still leaves nearly 500 bad Vanguard URLs elsewhere in the wiki.) --TedSwippet 07:47, 15 June 2023 (UTC)


 * ETA: now prototyped here: Special:PermanentLink/81077. I believe that the lookup table is mostly complete. The ETF section should be up-to-date, but the mutual fund section may need some additions or changes, since I created this from the old Vanguard prospectuses page. Additions or corrections welcome. --TedSwippet 12:57, 15 June 2023 (UTC)