Topic on Help talk:ChangeContentModel

Changing content model for all pages with a given prefix?

6
Evolution and evolvability (talkcontribs)

Is it possible to change the content model for:

  1. All current pages with a given prefix
  2. Any new pages created with that prefix?

The use case is changing from wikitext to Beta feature for talk pages for all wikiversity pages with prefix Talk:WikiJournal of Science/

Emojiwiki (talkcontribs)

Thats per-wiki. You can set a namespace's default content model to Flow, without changing any settings on Flow extension itself, or having any fixes.

If you want to change all current pages, a bot can help you to do so. Note that flow isn't standard text page, you will lost all data inside it if you change the content model in a page between Flow and wikitext!

Diegodlh (talkcontribs)

We have a similar question in the Web2Cit project. We use json configuration files stored in Meta, under Web2Cit/data/ (for example, meta:Web2Cit/data/uy/com/elobservador/www/templates.json). As suggested by @Strainu, it would be nice that they be assigned the "JSON" content model automatically so that (1) we can use the code editor with them, and (2) they are rendered nicely so they are easier to review.

With "thats per-wiki" you mean that this cannot be done?

In Meta, in the "User" namespace, files ending with .json are given the JSON content model (for example, meta:User:Diegodlh/Web2Cit/data/uy/com/elobservador/www/templates.json), whereas those ending with .js are given the JavaScript content model. Is content model automatically assigned in these cases based on a path pattern? Could the same approach be used to automatically assign the JSON content model to files following the Web2Cit/data/**/*.json pattern in the "Main" namespace?

We are also tracking this in phab:T305571.

Thanks!

The wub (talkcontribs)

@Diegodlh I'm not sure, but I think this could be done using Extension:JsonConfig and adding some settings to Wikimedia's configuration. If you search for JsonConfig in CommonSettings.php you can find how it has been done for a few other cases.

(How it works for the User namespace I'm not sure, that doesn't appear to be in the same configuration)

Diegodlh (talkcontribs)

Thank you very much, @The wub. This has been very helpful.

Indeed, the way to go seems to be adding some JsonConfig settings to Wikimedia's configuration.

(Just as a side note, I looked a little more into this and found that automatic content model assignment in the "User" namespace seems to be handled by the getDefaultModel function in Mediawiki's MainSloteRoleHandler.)

This post was hidden by Diegodlh (history)
Reply to "Changing content model for all pages with a given prefix?"