Skip to content

模块和主题的清单文件-Manifest Files for Modules and Themes

In the Orchard CMS, modules and themes are important tools for extending and customizing an application. Every module and theme is required to have a manifest, which is a text file named Module.txt or Theme.txt that resides in the root folder of the associated module or theme. A manifest stores metadata that Orchard uses to describe modules and themes to the system, such as name, version, description, author, and tags.

在Orchard CMS中,模块和主题是扩展和自定义应用程序的重要工具。每个模块和主题都需要有一个清单,它是一个名为Module.txtTheme.txt的文本文件,它位于相关模块或主题的根文件夹中。清单存储Orchard用于描述系统模块和主题的元数据,例如名称,版本,描述,作者和标签。

This topic is a reference for manifest files. If you create a custom module or theme, or if you write code that accesses modules or themes, you must understand the metadata fields in a manifest. The data in a manifest is structured into name-value pairs in the form Field Name: Value.

本主题是清单文件的参考。如果创建自定义模块或主题,或者编写访问模块或主题的代码,则必须了解清单中的元数据字段。清单中的数据以“字段名称:值”的形式构建为名称 - 值对。

The following sections describe the available fields in a manifest for themes and for modules. Because a theme is a type of module, many of the same metadata fields occur in both theme manifests and module manifests.

以下部分描述了主题和模块的清单中的可用字段。由于主题是一种模块,因此许多相同的元数据字段都出现在主题清单和模块清单中。

Module manifest fields

模块清单字段

The manifest for a module should be called Module.txt and should be located in the root of the project.

模块的清单应该称为Module.txt,并且应该位于项目的根目录中。

A module's manifest is made up of an overall description of the package itself and then an optional repeating section describing each of the individual features.

模块的清单由包本身的整体描述组成,然后是描述每个单独功能的可选重复部分。

The module can be comprised of a default single feature or a group of individually defined features. This allows module developers to specify separate areas of the module and allow users to enable them on a per-feature basis.

该模块可以包括默认的单个特征或一组单独定义的特征。这允许模块开发人员指定模块的单独区域,并允许用户基于每个功能启用它们。

Main Module.txt fields

主要Module.txt字段

Some of the fields may be overridden if a module defines multiple features. These are detailed in the Features: sub-section fields table below.

如果模块定义了多个功能,则可能会覆盖某些字段。这些在下面的[Features:sub-section fields](#moduletxt-features-sub-section-fields)表中有详细说明。

Field Name | Description

字段名称|描述

------------------ | ---------------------------------------------------

  • | -------------------------------------------------- -

Name |

Optional

Provides a human-readable name for a module.

If a name is provided, it will be used as the module's display name in the Orchard Gallery and in the Orchard UI.

If a name is not provided in the manifest, the ID is used instead.

Note: The ID of a module is generated internally from the name of the module's folder and is used for programmatic references to the module. For example, if the module is located in /Modules/Bing.Maps/ its ID would be Bing.Maps. To make things more friendly to the end user module developers should provide a name in the manifest such as Bing Mapping Component or even Bing Maps (notice that the "." is removed).

姓名 |

可选

为模块提供一个人类可读的名称。

如果提供了名称,它将在[Orchard Gallery]中用作模块的显示名称。 ](http://gallery.orchardproject.net/)和Orchard UI。

如果清单中没有提供名称,则使用ID。

注意:模块的ID是从模块文件夹的名称内部生成的,用于模块的编程引用。例如,如果模块位于/ Modules / Bing.Maps /,那么它的ID将是Bing.Maps。为了使最终用户模块更友好,开发人员应在清单中提供一个名称,例如Bing Mapping Component,甚至是Bing Maps(注意“。”被删除)。

Path |

Optional

Provides a name that is used to build more readable URLs for routing purposes compared to URLs that are based on module names or ID values.

If a path is not provided, Orchard builds URLs based on the module's name (if one is provided) or on the ID. However, module names often have spaces, and ID values often have "." characters, neither of which result in very readable URLs.

For example, for the Orchard.ArchiveLater module, its name is Archive Later, and its ID is Archive.Later. In the manifest, a path is provided with the value of ArchiveLater, which enables Orchard to build a more readable URL than the module name or the ID would.

Note: If specified, the Path must be a valid URL segment. If you're unsure what this means the best bet is to stick with letters and numbers with no spaces.

路径 |

可选

与基于模块名称或ID值的URL相比,提供用于构建更易读的URL以进行路由的名称。

如果路径未提供,Orchard根据模块的名称(如果提供了一个名称)或ID来构建URL。但是,模块名称通常具有空格,ID值通常具有“。”。字符,这两个字符都不会产生非常易读的URL。

例如,对于Orchard.ArchiveLater模块,其名称为Archive Later,其ID为Archive.Later。在清单中,路径提供了“ArchiveLater”的值,这使得Orchard能够构建比模块名称或ID更可读的URL。

注意:如果指定,则路径必须为有效的网址段。如果你不确定这意味着什么,最好的办法是坚持使用没有空格的字母和数字。

AntiForgery |

Required

Possible values are enabled or disabled.

A value that indicates whether request validation is enabled for a module.

AntiForgery |

必需

可能的值为“enabled”或“disabled”。

一个值,指示是否为模块启用了请求验证。

Author |

Optional

The developer of the module.

This can be an organization, individual, or a list of individuals.

作者 |

可选

模块的开发人员。

这可以是组织,个人或个人列表。

Website |

Optional

The URL for the website of the module developer.

网站 |

可选

模块开发人员网站的URL。

Version |

Required

The version number of the module in SemVer format.

The version information is displayed in the Orchard Gallery and in the Orchard UI.

It is also used to determine whether an update is available.

版本 |

必需

[SemVer](http://semver.org/)格式的模块版本号。

版本信息显示在[ Orchard Gallery](http://gallery.orchardproject.net/)和Orchard UI。

它还用于确定更新是否可用。

OrchardVersion |

Required

The minimum version of Orchard CMS that the module has been tested against.

OrchardVersion |

必需

模块已经过测试的最低版本的Orchard CMS。

Description |

Optional

A brief summary of what the module does.

The description is used in the Orchard Gallery and in the Orchard UI.

Will be overridden by the FeatureDescription field when present.

说明 |

可选

该模块的简要概述。

[Orchard Gallery](http://gallery.orchardproject.net/)中使用了该描述。并且在Orchard UI中。

当存在时,'FeatureDescription`字段将被覆盖。

Dependencies |

Required if the feature has dependencies. If all features are defined in the Features: subsection this field is not required.

A comma-separated list of the application Id values of all features that the specified feature depends on.

Note: dependencies are case sensitive.

依赖 |

如果功能具有依赖项,则为必需。如果所有功能都在Features:子部分中定义,则不需要此字段。

指定功能所依赖的所有功能的应用程序“Id”值的逗号分隔列表。

注意:依赖项是区分大小写**。

Category |

Optional

Defaults to uncategorized.

This field groups the module together in the Modules page of the Orchard admin dashboard. Related modules which have the same category are displayed together. The category field can be assigned one category. To aid in discoverability, module developers should review the Modules page of the Orchard admin dashboard and choose a related category from existing categories. If a relevant category doesn't exist modules can freely define a new category within this field.

类别 |

可选

默认为未分类

此字段将模块组合在Orchard管理信息中心的“模块”页面中。具有相同类别的相关模块一起显示。可以为类别字段分配一个类别。为了帮助发现,模块开发人员应查看Orchard管理仪表板的“模块”页面,并从现有类别中选择相关类别。如果相关类别不存在,模块可以在此字段中自由定义新类别。

Tags |

Optional

A comma-separated lists of tags for the module.

The tags field allow users to find related modules in the Orchard Gallery.

标签 |

可选

模块的逗号分隔标签列表。

标签字段允许用户在[Orchard Gallery]中找到相关模块(http:/ /gallery.orchardproject.net /).

FeatureDescription |

Optional

A description of the default feature in a module.

If the module has only a single feature, use either the FeatureDescription or Description field to describe it. The FeatureDescription will override the Description field.

If the module has multiple features and one of the features is the default, use the FeatureDescription field to describe the default feature. The FeatureDescription will override the Description field.

If the module has multiple features and doesn't define a default feature then leave this field out and follow the instructions in its description down in the Features: table below.

FeatureDescription |

可选

模块中默认功能的说明。

如果模块只有一个功能,请使用FeatureDescriptionDescription字段描述它。 FeatureDescription将覆盖Description字段。

如果模块有多个功能,其中一个功能是默认功能,请使用FeatureDescription字段来描述默认功能。 FeatureDescription将覆盖Description字段。

如果模块具有多个功能但没有定义默认功能,则将该字段保留,并按照“功能”中的说明进行操作。 :`下面的表。

Features |

Optional

A special repeating section of the manifest which allows a module to define multiple features within a module.

Supports several sub-fields as described by the table in the next section.

The features section should be placed at the end of the manifest.

特点 |

可选

清单的特殊重复部分,允许模块在模块中定义多个功能。

支持多个子字段,如表中所述下一节。

功能部分应放在清单的末尾。

Module.txt Features: sub-section fields

Module.txt 特点:子节字段

If a module provides multiple individual features within a single module then the repeating Features: sub-section should be used. It allows module developers to specify separate manifest fields for each individual feature. These individual features can then be enabled and disabled separately by end users.

如果模块在单个模块中提供多个单独的功能,则应使用重复的“Features:”子部分。它允许模块开发人员为每个单独的功能指定单独的清单字段。然后,最终用户可以单独启用和禁用这些单独的功能。

The Features: field doesn't have any assigned value. It is a placemarker field that indicates the beginning of a repeating list of features.

Features:字段没有任何指定的值。它是一个地标标记字段,指示重复的要素列表的开头。

Examples of the formatting to be used for this part of the manifest can be found in the next section.

可以在下一节中找到用于清单的这一部分的格式示例。

Field Name | Description

字段名称|描述

---------------------- | ---------------------------------------------------

  • | -------------------------------------------------- -

FeatureId |

Required

Because the feature is already contained within the module ID module developers need to supply a unique ID for Orchard to use internally as a reference.

The FeatureId should take the form of the name of the feature with no punctuation and full stops where spaces would be.

This is a special field. The line must begin with either a single tab character or four spaces. Immediately following this the Featured Id itself (the value not the field name) must be entered, followed by a colon :. This serve as an indented header for the specification of the feature.

Important: All fields below must begin with either two tab characters or eight spaces. This indentation process resets back to the left margin and the process repeats with the next feature. Examples of this are shown in the next section.

FeatureId |

必需

由于该功能已包含在模块ID模块中,因此开发人员需要为Orchard提供一个唯一的ID,以便在内部用作参考。

FeatureId应采用特征名称的形式,没有标点符号,并且在空格位置处应为句号。

这是一个特殊字段。该行必须以“单个制表符”“四个空格”开头。紧接着之后,必须输入Featured Id本身(而不是字段名称),然后输入冒号。这用作特征规范的缩进标题。

重要:以下所有字段必须以“两个制表符”“八个空格”开头。此缩进过程重置回左边距,并且该过程将重复下一个特征。这方面的例子将在下一节中介绍。

Name |

Optional

Provides a human-readable name for the feature.

If a name is provided, it will be used as the features display name in the Modules section of the Orchard admin dashboard.

If a name is not provided in the manifest, the FeatureId is used instead.

姓名 |

可选

为该功能提供一个人类可读的名称。

如果提供了名称,它将用作“模块”部分中的功能显示名称。 Orchard管理仪表板。

如果清单中没有提供名称,则使用FeatureId代替。

Description |

Optional

A description of the feature. If this is the default feature of the module use the FeatureDescription instead.

说明 |

可选

该功能的说明。如果这是模块的默认功能,请改用“FeatureDescription”。

FeatureDescription |

Optional

Either the main manifest section should define this field or a single feature in the features sub-section should assign this field.

It should contain a description of the individual feature.

FeatureDescription |

可选

主要清单部分应定义此字段,或者要素子部分中的单个要素应指定此字段。

它应包含对此字段的描述个人特征。

Category |

Optional

Defaults to uncategorized.

This field groups the feature together in the Modules page of the Orchard admin dashboard. Related features which have the same category are displayed together.

Each individual feature can be assigned one category, however the different features included in the module may have each have their own category to move that feature into the most relevant area of the admin dashboard.

To aid in discoverability, module developers should prefer to review the Modules page of the Orchard admin dashboard and choose a related category from existing categories. If a relevant category doesn't exist modules can freely define a new category within this field of the manifest.

类别 |

可选

默认为未分类

此字段将该功能组合在Orchard管理信息中心的“模块”页面中。具有相同类别的相关功能将一起显示。

每个单独的功能可以分配一个类别,但模块中包含的不同功能可能各自具有自己的类别,以将该功能移动到最相关的管理仪表板的区域。

为了帮助发现,模块开发人员应该更愿意查看Orchard管理仪表板的模块页面,并从现有类别中选择相关类别。如果相关类别不存在,则模块可以在清单的此字段中自由定义新类别。

Dependencies |

Required if the feature has dependencies

A comma-separated list of the application Id values of all features that the specified feature depends on.

Each individual feature should only define its own dependencies. If all features are defined in the Features: subsection this main Dependencies field is not required.

Note: dependencies are case sensitive.

依赖 |

如果要素具有依赖关系,则为必需

指定要素所依赖的所有要素的应用程序“Id”值的逗号分隔列表。

每个要素应该只定义自己的依赖项。如果所有功能都在Features:子部分中定义,则不需要这个主要的“依赖关系”字段。

注意:依赖关系是区分大小写**。

Priority |

Optional

The default is 0 and higher priorities will take precedence.

Used by Orchard to determine how to resolve dependencies implementing a specific interface.

优先 |

可选

默认值为“0”,优先级越高越好。

Orchard用于确定如何解决实现特定接口的依赖关系。

Module manifest examples

模块清单示例

Listed below are the three different ways you can use the module manifest.

下面列出了使用模块清单的三种不同方法。

Single feature module

单一功能模块

Name: Modules

AntiForgery: enabled

Author: The Orchard Team

Website: http://orchardproject.net

Version: 1.9.1

OrchardVersion: 1.9

Description: The Modules module enables the administrator of the site to manage the installed modules as well as activate and de-activate features.

FeatureDescription: Standard module and feature management.

Dependencies: Orchard.ExampleModule, Orchard.AnotherModule

Category: Core

Multiple features with a default module in the main manifest

主清单中具有默认模块的多个功能

The Orchard.Alias module itself (defined as Name: Alias) is its own default feature. There are two extra optional features defined in the Features which can be separately enabled. In this case they both have dependencies on their parent feature Orchard.Alias but module developers can define independent features as well.

Orchard.Alias模块本身(定义为Name:Alias)是它自己的默认功能。 “功能”中定义了两个额外的可选功能,可以单独启用。在这种情况下,它们都依赖于它们的父特征“Orchard.Alias”,但模块开发人员也可以定义独立的特性。

Name: Alias

AntiForgery: enabled

Author: The Orchard Team

Website: http://orchardproject.net

Version: 1.9.1

OrchardVersion: 1.9

Description: Maps friendly urls to specific module actions.

FeatureDescription: Maps friendly urls to specific module actions.

Category: Content

Features:

    Orchard.Alias.UI:

        Name: Alias UI

        Description: Admin user interface for Orchard.Alias.

        Dependencies: Orchard.Alias, Orchard.ExampleModule

        Category: Content

    Orchard.Alias.Updater:

        Name: Alias Updater

        Description: Synchronizes aliases when created from different servers.

        Dependencies: Orchard.Alias

        Category: Content

Multiple features all defined in the features sub-section of the manifest

清单的功能子部分中定义的多个功能

Name: AntiSpam

AntiForgery: enabled

Author: The Orchard Team

Website: http://orchardproject.net

Version: 1.9.1

OrchardVersion: 1.9

Description: Provides anti-spam services to protect your content from malicious submissions.

Features:

    Orchard.AntiSpam:

        Name: Anti-Spam

        Description: Provides anti-spam services to protect your content from malicious submissions.

        Category: Security

        Dependencies: Orchard.Tokens, Orchard.jQuery

    Akismet.Filter:

        Name: Akismet Anti-Spam Filter

        Description: Provides an anti-spam filter based on Akismet.

        Category: Security

        Dependencies: Orchard.AntiSpam

    TypePad.Filter:

        Name: TypePad Anti-Spam Filter

        Description: Provides an anti-spam filter based on TypePad.

        Category: Security

        Dependencies: Orchard.AntiSpam

Notice the structure that is used for each feature described in the Features field. The FeatureId of the feature is listed followed by a colon :. Then on a new line for each field, you can specify the other relevant fields including Name, Description, Category and Dependencies.

请注意用于“功能”字段中描述的每个功能的结构。列出该功能的FeatureId后跟冒号。然后在每个字段的新行上,您可以指定其他相关字段,包括“Name”,“Description”,“Category”和“Dependencies”。

For more information about how to create a module, including how to generate a manifest file and how to modify the manifest, see these guides:

有关如何创建模块的更多信息,包括如何生成清单文件以及如何修改清单,请参阅以下指南:

Theme manifest fields

主题清单字段

A theme manifest can have the following fields:

主题清单可以包含以下字段:

Field Name | Description

字段名称|描述

----------- | ----------------------------------------------------

  • | -------------------------------------------------- -

Name | Provides a human-readable name for a theme that is an alternative to using the theme's ID. The ID of a theme is the name of the theme's folder in the virtual base path (the default virtual base path is ~/Themes), and is used for programmatic references. For example, for a theme whose ID is Orchard.Theme.Contoso, you might provide a name in the manifest such as Contoso Theme. If you do not provide a name in the manifest, the ID is used instead. If you do provide a name, it will be used as the theme's display name in the Orchard Gallery and in the Orchard UI.

名称|为主题提供可读的名称,以替代使用主题的ID。主题的ID是虚拟基本路径中主题文件夹的名称(默认虚拟基本路径是“〜/ Themes”),用于编程引用。例如,对于ID为“Orchard.Theme.Contoso”的主题,您可以在清单中提供名称,例如“Contoso Theme”。如果您未在清单中提供名称,则使用ID。如果您确实提供了名称,它将在[Orchard Gallery](http://gallery.orchardproject.net/)和Orchard UI中用作主题的显示名称。

Description | A brief summary of a theme's appearance and layout details. The description is used in the Orchard Gallery and in the Orchard UI.

说明|主题外观和布局细节的简短摘要。该描述用于[Orchard Gallery](http://gallery.orchardproject.net/)和Orchard UI。

Version | The version number of a theme. The version information is displayed in the Orchard Gallery and the Orchard UI, and is also used to determine whether an update is needed.

版本|主题的版本号。版本信息显示在[Orchard Gallery](http://gallery.orchardproject.net/)和Orchard UI中,还用于确定是否需要更新。

Author | The developer of a theme. This can be an organization, individual, or a list of individuals.

作者|主题的开发者。这可以是组织,个人或个人列表。

Website | The URL for the website of the theme developer.

网站|主题开发人员网站的URL。

Tags | A comma-separated lists of tags for the theme. The tags can be used to filter or group themes in a list. For example, a custom online gallery of themes can provide the ability to filter and display themes by tag.

标签|以逗号分隔的主题标签列表。标签可用于过滤或分组列表中的主题。例如,自定义在线主题库可以提供按标签过滤和显示主题的功能。

Zones | A comma-separated list of the Orchard zones that are used by a theme. These zones are displayed in the Orchard dashboard and can be used to customize the layout of a site by adding, removing, or arranging widgets.

区域|主题使用的以逗号分隔的Orchard区域列表。这些区域显示在Orchard仪表板中,可用于通过添加,删除或排列小组件来自定义站点的布局。

BaseTheme | The ID of another theme that this theme inherits from. This is an optional field. It is useful in cases where you want to customize an existing theme by copying it and then making some changes in style and appearance. When you use this approach, add the BaseTheme field to the manifest for the customized theme, and specify the Id of the base theme. For example, if you customized the Contoso theme, you could add the line BaseTheme: Orchard.Theme.Contoso to the manifest of your theme.

BaseTheme |此主题继承的另一个主题的ID。这是个可选的选项。在您希望通过复制现有主题然后在样式和外观上进行一些更改来自定义现有主题的情况下,它非常有用。使用此方法时,将“BaseTheme”字段添加到自定义主题的清单中,并指定基本主题的“Id”。例如,如果您自定义了Contoso主题,则可以将“BaseTheme:Orchard.Theme.Contoso”行添加到主题的清单中。

The following example shows the manifest for The Theme Machine theme, which is the default Orchard theme.

以下示例显示 Theme Machine 主题的清单,它是默认的Orchard主题。

Name: The Theme Machine

Author: jowall, mibach, loudej, heskew

Description: Orchard Theme Machine is a flexible multi-zone theme that provides a solid foundation to build your site. It features 20 collapsible widget zones and is flexible enough to cover a wide range of layouts.

Version: 1.9.1

Tags: Awesome

Website: http://orchardproject.net

Zones: Header, Navigation, Featured, BeforeMain, AsideFirst, Messages, BeforeContent, Content, AfterContent, AsideSecond, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer

For more information about how to write a theme, including how to generate and modify a manifest, see Writing a New Theme. For information about how to customize an existing theme and then generate a manifest for it, see Customizing Themes.

有关如何编写主题的更多信息,包括如何生成和修改清单,请参阅[编写新主题](编写新主题)。有关如何自定义现有主题然后为其生成清单的信息,请参阅[自定义主题](自定义默认主题)。