From 617841f41b15c064b8e0b6415dd390b0f25e94f0 Mon Sep 17 00:00:00 2001 From: Guillermo Siesto Date: Thu, 5 Mar 2026 11:54:22 +0200 Subject: [PATCH] integrate IndexNow API for proactive search engine crawling --- .github/workflows/deploy.yml | 8 +++++++- public/7a258aaa2a9b472bb6e97935fe5e82ca.txt | 1 + src/app/robots.ts | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 public/7a258aaa2a9b472bb6e97935fe5e82ca.txt diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 52a9b47..e6b3c74 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -156,4 +156,10 @@ jobs: CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} run: | aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" - echo "CloudFront cache invalidation requested." \ No newline at end of file + echo "CloudFront cache invalidation requested." + + - name: Ping IndexNow + run: | + echo "Notifying Bing and other search engines via IndexNow..." + curl -s "https://api.indexnow.org/indexnow?url=https://pdflince.com&key=7a258aaa2a9b472bb6e97935fe5e82ca" + echo "IndexNow pinged successfully." \ No newline at end of file diff --git a/public/7a258aaa2a9b472bb6e97935fe5e82ca.txt b/public/7a258aaa2a9b472bb6e97935fe5e82ca.txt new file mode 100644 index 0000000..155dcba --- /dev/null +++ b/public/7a258aaa2a9b472bb6e97935fe5e82ca.txt @@ -0,0 +1 @@ +7a258aaa2a9b472bb6e97935fe5e82ca \ No newline at end of file diff --git a/src/app/robots.ts b/src/app/robots.ts index 2c391b0..192de3f 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -6,7 +6,9 @@ export const revalidate = false; export default function robots(): MetadataRoute.Robots { const baseUrl = "https://pdflince.com"; - return { + // Cast to bypass Next.js restricted Sitemap type since it doesn't officially support 'host' yet + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const robotsObj: any = { rules: { userAgent: "*", allow: "/", @@ -15,5 +17,8 @@ export default function robots(): MetadataRoute.Robots { ], }, sitemap: `${baseUrl}/sitemap.xml`, + host: "https://api.indexnow.org/indexnow?url=https://pdflince.com&key=7a258aaa2a9b472bb6e97935fe5e82ca", }; + + return robotsObj as MetadataRoute.Robots; }