Skip to main content

submit_to_indexnow

Function submit_to_indexnow 

Source
pub fn submit_to_indexnow(
    ctx: &Ctx,
    urls: &[String],
) -> impl Future<Output = Result<()>> + Send + use<>
Expand description

Tells IndexNow-participating search engines (Bing, Yandex, Seznam, Naver…) that urls were added or changed.

One POST to INDEXNOW_ENDPOINT with the URLs (absolute, on APP_URL’s host, at most 10,000), the INDEXNOW_KEY and where to check it (indexnow_routes). Call it after publishing (a deploy script, a job): engines may ignore sites that submit unchanged pages often.

§Errors

Error::Internal when APP_URL or a valid INDEXNOW_KEY is missing, or IndexNow refuses the submission (it answers 200 or 202 when accepted).

§Examples

use ocre::{Ctx, Result, seo};

async fn published(ctx: &Ctx, slug: &str) -> Result<()> {
    let url = ocre::mail::url(ctx, &format!("/blog/{slug}"))?;
    seo::submit_to_indexnow(ctx, &[url]).await
}