Search sitemap configuration in mini program

Search sitemap configuration in mini program

WeChat has now opened search within mini-programs . Developers can configure whether their mini-program pages are allowed to be indexed by WeChat through sitemap.json configuration or by managing the backend page inclusion switch. When developers allow WeChat indexing, WeChat will index the page content of the Mini Program through crawlers. When a user's search term triggers the index, the Mini Program's page may be displayed in the search results. When a crawler accesses a page in a mini program, it carries a specific user-agent: mpcrawler and a scenario value: 1129. It should be noted that if the page data discovered by the mini program crawler is inconsistent with the presentation of the real user, the page will not be included in the index.

Sitemap Configuration

The sitemap.json file in the root directory of the Mini Program 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 there is no sitemap.json, all pages are allowed to be indexed by default; sitemap.json has the following properties:

Configuration items

property type Required describe
rules Object[] yes Index rules list

rules

The rules configuration item specifies the index rules. Each rule is a JSON object with the following properties:

property type Required default value Value Value Description
action string no "allow" "allow", "disallow" Whether the pages that match this rule can be indexed
page string yes "*", the path of the page * represents all pages and cannot be used as a wildcard
params string[] no [] A list of page parameter names (without parameter values) that may be used when the page specified by the page field is matched by this rule.
matching string no "inclusive" Refer to the matching value description When the page specified by the page field is matched by this rule, this parameter describes the params matching method
priority Number no Priority, the larger the value, the earlier the rule is matched, otherwise it is matched from top to bottom by default

matching value description

value illustrate
exact When the parameter list of the mini program page is equal to params, the rule hits
inclusive When the parameter list of the mini program page contains params, the rule hits
exclusive When the intersection of the parameter list of the mini program page and params is empty, the rule hits
partial When the intersection of the parameter list of the mini program page and params is not empty, the rule hits

Configuration Example

Example 1

 {
  "rules":[{
    "action": "allow",
    "page": "path/to/page",
    "params": ["a", "b"],
    "matching": "exact"
  }, {
    "action": "disallow",
    "page": "path/to/page"
  }]}
  • path/to/page?a=1&b=2 => Priority index
  • path/to/page => not indexed
  • path/to/page?a=1 => not indexed
  • path/to/page?a=1&b=2&c=3 => not indexed
  • All other pages will be indexed

Example 2

 {
  "rules":[{
    "action": "allow",
    "page": "path/to/page",
    "params": ["a", "b"],
    "matching": "inclusive"
  }, {
    "action": "disallow",
    "page": "path/to/page"
  }]}
  • path/to/page?a=1&b=2 => Priority index
  • path/to/page?a=1&b=2&c=3 => Priority index
  • path/to/page => not indexed
  • path/to/page?a=1 => not indexed
  • All other pages will be 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/page?c=3 => Priority index
  • path/to/page?a=1 => not indexed
  • path/to/page?a=1&b=2 => not indexed
  • All other pages will be indexed

Example 4

 {
  "rules":[{
    "action": "allow",
    "page": "path/to/page",
    "params": ["a", "b"],
    "matching": "partial"
  }, {
    "action": "disallow",
    "page": "path/to/page"
  }]}
  • path/to/page?a=1 => Priority index
  • path/to/page?a=1&b=2 => Priority index
  • path/to/page => not indexed
  • path/to/page?c=3 => not indexed
  • All other pages will be indexed

Note: If there is no sitemap.json, all pages can be indexed by default

Note: {"action": "allow", "page": "*"} is the default rule with the lowest priority. All pages without "disallow" are indexed by default.

<<:  Community operation: How can community fission activities achieve high conversion rates?

>>:  The 4 user quadrants of product promotion!

Recommend

Will I be iodine deficient if I stop eating seafood?

In the age of universal iodine supplementation, p...

How to configure the company website server rental?

Recently, Jimifeng Network Customer Service has o...

Why are mobile phones getting heavier nowadays?

Mobile phones are not only our communication tool...

Hot topic! Is the crunchy Gongcai in hot pot actually dried lettuce?

Recently, the topic #Gongcai is dried lettuce# ha...

Farewell to "Sophia": Observatories cannot rely solely on romantic feelings

What is the first thing that comes to your mind w...

Google advertising strategy

How can we achieve twice the result with half the...

Event planning and promotion, how to plan and execute an event?

1. Event Planning Overview There are three keys t...