Help:ChangeContentModel/zh

Special:ChangeContentModel页面可以用于修改一个页面的“内容模型”. 内容模型应用非常广泛，它是Wiki上给定页面的格式或类型. 默认情况下一个页面的内容模型是wiki文本，这是一种使用wiki标记的富文本格式. 维基媒体基金会项目上使用的内容模型包括css和javascript（用于存储代码），wikibase-item（用于Wikidata上的项目）和Campaign（在维基共享资源）上用于上传活动（如Wiki Loves Monuments，“维基爱古迹”）. 有关内容模型的列表，参见内容处理器. 更多相关的技术信息，参见手册:内容处理器.

所有行为都被记载于Special:Log/contentmodel，包括了一个便利的“”链接来在必要时撤销更改. 用户必须拥有 权限才能更改内容模型. 在维基媒体基金会项目，这一权限目前仅赋予管理员.

背景
在以前，你只能在MediaWiki上创建一种页面类型，即维基文本：用维基文本标记编写的富文本文档. 这对于在维基百科上编写百科全书条目是合适的，但对于其他类型的内容，如源代码块、结构化数据内容或复杂的工作流程是不合适的.

随着2012年维基数据项目（以及维基资料库扩展）的出现，开发的ContentHandler分支允许创建wiki文档之外的页面. 从MediaWiki 1.21开始，ContentHandler是核心MediaWiki软件的一部分.

一些通用的内容模型包括那些用于存储和呈现源代码的模型，但是它们也可以被用于创建自定义的编辑界面. 例如，您可以使用诸如JSON之类的结构化格式存储基础数据，然后编写MediaWiki扩展，在此结构化数据之上构建自定义编辑界面；而不用使用可怕的模板来构成页面上的内容. MassMessage使用此方法创建传递列表页面，CollaborationKit使用此方法创建维基项目. 尽管这些扩展具有自己的页面创建工作流程，但也可以使用Special:ChangeContentModel.

As an alternative to setting content models on a page-by-page basis, you can specify alternative defaults for a given namespace. For example, the default content model in the Module namespace is ScribuntoContent. Similarly, you can enforce that a given content model is only used in a given namespace; ScribuntoContent can only be used in the Module namespace.

查看页面当前的内容模型
要查看一个页面当前的内容模型，点击侧边栏工具箱中的“”. 你也可以在网址上追加 前往相同的页面.

更改页面的内容模型
Go to Special:ChangeContentModel (or follow the "change" link on the "Page information" page), enter the page name you wish to change. This can be a non-existent page if you wish to create a new page that uses a different content model from the default. Next, choose the content model you wish to change to. Click "" to make the change.

Note that not all conversions are possible. If you are trying to convert a page that already exists and the MediaWiki software cannot figure out how to re-interpret the current page's content, the content model will not be converted and you will get an error message. When this happens, it is recommended that you archive the old page and create the page anew in the new content model. For instance, you could rename "Project:Foo" to "Project:Foo/old" and then use Special:ChangeContentModel to create a new page at "Project:Foo". If possible, you should include a link to "Project:Foo/old" on the new page.

復原一個操作
All content model changes are logged at Special:Log/contentmodel on your wiki. To undo a change, go to the relevant entry in the log and click "". You will see a pre-filled form; click "" to carry out the revert. If you are viewing the page history and the most recent change was the one that changed the content model, you can use the undo feature to change the content model back. Rollback will also undo any content model changes.

Note that this may not always work, particularly if the page was edited after the content model was changed in such a way to make it incompatible with the old content model. When this happens, you will have to undo the edits that made it incompatible. Alternatively, you could carry out the content model change anew and archive the old content. Ideally, content model changes are few and far between. In most situations, a page will not have to change content model more than once.