# sitemap Configuration
Mini-Program search is now available. Developers can configure whether their Mini-Program pages are allowed to be indexed by configuring sitemap.json. It will establish an index for the Mini-Program's page content through a crawler. When a user's search query triggers this index, the Mini-Program's pages may appear in the search results.
# 1. sitemap Configuration
The sitemap.json file in the Mini-Program root directory is used to configure whether the Mini-Program and its pages are allowed to be indexed by WeChat. The file content is a JSON object. If sitemap.json does not exist, all pages are allowed to be indexed by default. sitemap.json has the following properties:
# 1.1 Configuration Items
| Property | Type | Required | Description |
|---|---|---|---|
| rules | Object[] | Yes | Index rule list |
# 1.2 rules
The rules configuration item specifies the indexing rules. Each rule is a JSON object with the following properties:
| Property | Type | Required | Default Value | Valid Values | Value Description |
|---|---|---|---|---|---|
| action | string | No | "allow" | "allow", "disallow" | Whether pages matching this rule can be indexed |
| page | string | Yes | "*", page path | "*" represents all pages; cannot be used as a wildcard |
# 2. Configuration Example
{
"rules":[{
"action": "disallow",
"page": "path/to/page1"
}, {
"action": "disallow",
"page": "path/to/page2"
}]
}
path/to/page1=> Not indexedpath/to/page2=> Not indexed- All other pages will be indexed
# 3. Special Cases Explanation
- If
sitemap.jsondoes not exist, all pages are allowed to be indexed by default; {"action": "allow", "page": "*"}is the lowest priority default rule. Pages not explicitly marked as"disallow"are indexed by default;- The
sitemap.jsonfile content has a maximum size of5120UTF8 characters; - For pages that are not suitable to be included by the platform, developers can also use
sitemap.jsonto declare and handle them.
# 4. Disclaimer
If developers fail to follow the prompts and guidelines provided in this configuration for setting up the functionality, resulting in the display, disclosure, unauthorized access, or leakage of users' personal information, all legal responsibilities shall be borne by the developers.
If user information is inappropriately displayed or similar situations occur, we may take measures including but not limited to requiring developers to rectify within a specified period to ensure the security of user information.