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

8 Keys for Startups to Find the Best Investors

In the past two years, the relationship between e...

Trash! Why is the usage rate so low every time a coupon is issued?

Coupons are widely used, from offline stores to o...

6 creative ways to use information flow advertising

Operations often complain about poor click-throug...

Which drugs are in conflict with the "aura" of the popular sauce-flavored latte?

The recent popularity of Ruimao has given coffee ...

Chang'e 6 is launched today! Reviewing Chang'e's 17-year lunar exploration feat!

On May 1, the National Space Administration relea...

Ten tips on advertising

Many people understand advertising as "burni...

A comprehensive review of the development of China's large aircraft

May 5, 2017, Shanghai Pudong Airport. This is one...

Operators, how can you take advantage of the trend elegantly?

Recently, I have read books on "market trend...

Health Science | Rubbing your eyes is so harmful?! Stop it!

(Statement: This article is from Hubei Tiantian P...

Why are those medicines that have grown with us gradually disappearing?

Recently, the State Drug Administration issued th...