Skip to content

Create post indexer #12174

@herregroen

Description

@herregroen

We want to watch posts so we can call MyYoast ( see https://github.com/Yoast/my-yoast/issues/2317 ) to provide live-indexing functionality when posts change.

We want a class similar to the current WPSEO_Post_Watcher.

Indexing is done by sending a request to: POST https://my.yoast.com/api/sites/index/ with the following parameters:

  • urls: An object with three possible keys ( add, update and delete ) and arrays of urls as values.
  • token: The OAuth access token.

For example:

{
  token: "token",
  urls: {
    add: [ "https://example.com/about" ],
    update: [ "https://example.com/home", "https://example.com/contact" ]
  }
}

Note: These will not work without an active MyYoast connection (OAuth).
Note: Posts means ALL public post-types.
Note: This endpoint is going to return the number of requests that still can be made successfully (based on the limits that apply for the site). Handling these limits is going to be a separate issue.

For posts:

  • A new public post is created -> Add the post URL
  • A public post is thrashed -> Update the URL

Post is updated:

  • Title or content has changed -> Update the URL.
  • URL of the post (full permalink) has changed -> Update the old url, add the new url.
  • Post visibility has changed (on the post itself) -> Update the url.
    • Public to non-public -> Update the url.
    • Non-public to public -> Add the url.
  • No-index status has changed -> Update or add the url, based on the new setting.

Requirement:

  • A filter needs to be added to allow plugin authors/developers to control if a specific update should not be send to the Live Indexing endpoint - this filter needs to be "true" by default and provide sufficient context about what has changed, to base a decision on.

For MVP we are:

  • not going to listen for Term changes
  • not going to do anything with search appearance changes for post types

Parent #12136

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions