Topic on Help talk:TemplateData

Visual Editor corrupts TemplateData-generated transclusions on save, when not using short URL format

4
Summary last edited by Clump 21:59, 2 July 2021 2 years ago

As tracked in the referenced Phabricator bug, the Visual Editor does not support "long" URLs of the form https://site.name/index.php?title=Page_name. Only so-called "short" URLs, e.g. https://site.name/wiki/Page_name, are compatible with Visual Editor.

Bjsdaiyu (talkcontribs)

MW 1.35.0, TemplateData 0.1.2

I have templates defined using TemplateData. Filling in and editing these templtates works fine in Visual Editor (VE) up through the first save, for example this image, but upon subsequent edits it cannot find the template as shown here: it strangely believes that :index.php?title=Template:<Template Name> is the name of the Template page! Any thoughts

FeRDNYC (talkcontribs)

Hmm. A few questions:

  1. What does the "Generated from:" text show in the popup box for the template, when you commit the data edits in the Visual Editor (before you save)?
  2. What does it show after you save, then edit the page again?
  3. If you switch to Source Editing while you're re-editing the page, does it show the correct template transclusion, e.g. {{Cite book|something=|something_else=|...}}
  4. What is the URL format for your wiki? Like, what's the actual URL to Template:Cite book? What's the URL for the article you're editing?

On Wikipedia, Template:Cite book lives at https://en.wikipedia.org/wiki/Template:Cite_book.

So if I'm editing https://en.wikipedia.org/wiki/The_Cat_in_the_Hat and want to cite Dr. Seuss, the URL to Template:Cite Book has the same https://en.wikipedia.org/wiki/ prefix. Same for the article's edit interface, which loads from https://en.wikipedia.org/wiki/The_Cat_in_the_Hat?action=edit

But it looks like either your wiki is using old-style index.php?title= URLs and the Visual Editor is mishandling those, or something is configured to think the URLs should be index.php?title=-style when they're not. (Are there any rewriting rules / HTTP redirects configured on the wiki's web server, for article paths?)

GeoffreyHfr (talkcontribs)

I have the same problem. I just found a bug logged pointing at the no-usage of Short URL :

https://phabricator.wikimedia.org/T270219


They give some workaround.

I have just added $wgUsePathInfo=true; to my LocalSettings.php for it to work.

FeRDNYC (talkcontribs)

Ooh, good find @GeoffreyHfr, that bug clearly describes exactly the problem here. According to the info there, Visual Editor simply doesn't support index.php?title= URLs, period. Apparently it never has, since Wikipedia has used short URLs since long before Visual Editor became a thing.

(Might be nice if that was documented somewhere prominent, or if it had some way to detect those URLs and at least display a helpful error message. Still, at least now people have this bug to refer to, so that's something.)

Reply to "Visual Editor corrupts TemplateData-generated transclusions on save, when not using short URL format"