WeChat is now open to search within the Mini Program, developers can through sitemap.json Configuration, or management background page included switch to configure the Mini Program page whether to allow WeChat index. When developers allow WeChat to index, WeChat will be in the form of crawlers, for the Mini Program page content index. When a user's search term triggers the index, the page of the Mini Program may appear in the search results. When a crawler visits a page within a Mini Program, it carries a specific user-agent:mpcrawler andScene value1129Note that if the page data found by the Mini Programs crawler is not consistent with the actual user's presentation, the page will not enter the index.

# sitemap Configuration

Mini Program root directory sitemap.json The file is used to configure the Mini Program and whether its page is allowed to be indexed by WeChat. JSON Object, if there is no sitemap.json All pages are allowed to be indexed by defaultsitemap.json Have the following attributes:

# Configuration item

attribute type Required describe
rules Object[] yes Index rule list

# rules

rules The configuration items specify the indexing rules, each of which is a JSON object with the following attributes:

attribute type Required Default value Value Value explaination
action string no "allow" "allow"、"disallow" Can a page hit by this rule be indexed
page string yes "*" Page path * Represents all pages and cannot be used as a wildcard
params string[] no [] when page A list of page parameter names that the page specified by the field may use when matched by this rule (without parameter values)
matching string no "including" Reference matching Value explaination when page When the page specified in the field is matched by this rule, this parameter indicates params Matching method
priority Number no Priority, the higher the value, the earlier the rule will be matched, otherwise the default match from top to bottom

matching Value explaination

value Introductions
exact When the parameter list of the Mini Programs page is equal to params When the rule hits
Including When the parameter list for the Mini Programs page contains params When the rule hits
exclusive When the parameter list of the Mini Program page is matched with the params Rule hits when intersection is empty
partial When the parameter list of the Mini Program page is matched with the params When intersection is not empty, rule hits

# Configuration sample

Example 1

{
  "rules":[{
    "action": "allow",
    "page": " path/to/page",
    "params": ["a", "b"],
    "matching": "exact"
  }, {
    "action": "disallow",
    "page": " path/to/page"
  }]
}
  • path/to/pagea=1&b=2 => Priority index
  • path/to/page => Not indexed
  • path/to/pagea=1 => Not indexed
  • path/to/pagea=1&b=2&c=3 => Not indexed
  • All the other pages are indexed.

Example 2

{
  "rules":[{
    "action": "allow",
    "page": " path/to/page",
    "params": ["a", "b"],
    "matching": "including"
  }, {
    "action": "disallow",
    "page": " path/to/page"
  }]
}
  • path/to/pagea=1&b=2 => Priority index
  • path/to/pagea=1&b=2&c=3 => Priority index
  • path/to/page => Not indexed
  • path/to/pagea=1 => Not indexed
  • All the other pages are indexed.

Example 3

{
  "rules":[{
    "action": "allow",
    "page": " path/to/page",
    "params": ["a", "b"],
    "matching": "exclusive"
  }, {
    "action": "disallow",
    "page": " path/to/page"
  }]
}
  • path/to/page => Priority index
  • path/to/pagec=3 => Priority index
  • path/to/pagea=1 => Not indexed
  • path/to/pagea=1&b=2 => Not indexed
  • All the other pages are indexed.

Example 4

{
  "rules":[{
    "action": "allow",
    "page": " path/to/page",
    "params": ["a", "b"],
    "matching": "partial"
  }, {
    "action": "disallow",
    "page": " path/to/page"
  }]
}
  • path/to/pagea=1 => Priority index
  • path/to/pagea=1&b=2 => Priority index
  • path/to/page => Not indexed
  • path/to/pagec=3 => Not indexed
  • All the other pages are indexed.

Note: None sitemap.json Default all pages can be indexed

Note:{"action": "allow", "page": "*"} Is the lowest priority default rule, not explicitly indicated "disallow" Are indexed by default