Laravel IndexNow - Submit webpage updates to search engines

Overview

Laravel IndexNow - Submit webpage updates to search engines

Latest Version on Packagist Code Quality Tests Code Coverage License Total Downloads

This packages provides a wrapper to use the IndexNow api in Laravel. This makes indexing new webpages in (some) search engines easy and fast. It makes for a nice little addition to sitemaps.

IndexNow is an API created by Microsoft Bing & Yandex to allow you to submit page changes to their search engines quickly. A submission to one search engine will automatically pass the submission on to the others.

At the time of this writing Google is considering supporting the API and has announced it will be testing it.

Installation

You can install the package via composer:

composer require laravel-freelancer-nl/laravel-index-now

You can publish the config file with:

php artisan vendor:publish --tag="index-now-config"

This is the contents of the published config file:

return [
    'host' => env('APP_URL', 'localhost'),
    'key' => env('INDEXNOW_KEY', ''),
    'key-location' => env('INDEXNOW_KEY_LOCATION', ''),
    'log-failed-submits' => env('INDEXNOW_LOG_FAILED_SUBMITS', true),
    'production-env' => env('INDEXNOW_PRODUCTION_ENV', 'production'),
    'search-engine' => env('INDEXNOW_SEARCH_ENGINE', 'api.indexnow.org'),
    'delay' => env('INDEXNOW_SUBMIT_DELAY', 600),
];
  • host: the domain for which you will submit pages to the search engine
  • key: the unique key for this domain (you will generate one in the next step)
  • key-location: the directory and/or prefix to the key file
  • log-failed-submits: disable logging of submit attempts in non-production environments
  • production-env: the name of the production environment;
  • search-engine: the domain of the specific search engine you wish to submit too.
  • delay: the delay in seconds for delayed page submissions.

Generate a new key

The IndexNow API matches the request key to a key file within the host domain. To generate the keyfile you use the following artisan command:

php artisan index-now:generate-key

This will create a keyfile in the public_dir() of your project and output the key. Copy the displayed key and place it in your .env file.

If you've set a key location in the config it will be prefixed to the file.

Running this command multiple times will generate a new key and key file.

Only submit pages for your production environment

You probably don't want to submit pages in any environment other than production.

By default, this package assumes that your production environment is called 'production' and will only submit when it matches the configured name in the package.

In the case of an environment mismatch it will log a submission 'attempt' instead of actually submitting the page to the search engines.

If you use an alternative name for your production environment you can set INDEXNOW_PRODUCTION_ENV in your .env to match.

You can disable this by setting INDEXNOW_PRODUCTION_ENV to false.

Usage

You can submit one or more pages per request by calling the facade and passing the url(s) to the submit method.

Note that the urls must be fully qualified without query parameters and without a fragment.

Submit a single page

use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;

IndexNow::submit('https://dejacht.nl/jagen');

Submit a multiple pages

To submit multiple pages at once just add an array of urls.

use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;

IndexNow::submit([
    'https://dejacht.nl',
    'https://dejacht.nl/fotoquiz/',
    'https://dejacht.nl/jagen/',
    'https://dejacht.nl/jachtvideos/',
]);

Prevent spam: delay page submissions

You can delay page submissions by using the delaySubmission method. This dispatches the IndexNowSubmitJob with a delay in seconds as configured. The job is unique by payload, so multiple submissions of the same urls won't push a job to the queue before the current one is handled.

use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;

IndexNow::delaySubmission('https://devechtschool.nl');

You can override the configured default delay by adding your own.

use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;

IndexNow::delaySubmission('https://devechtschool.nl', 100);

When to delay submits

It isn't uncommon for people to make additional edits after creating or updating a page. On these actions it is a good idea to delay the submission.

When deleting pages you can just submit the urls immediately.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
Releases(1.1)
Owner
Laravel Freelancer NL
Laravel Freelancer NL
This Laravel package allows for batching of Scout updates.

Laravel Scout Batch Searchable This Laravel package allows for batching of Scout updates. Requirements Laravel Scout 9+ Scheduler with cron Descriptio

Optimist Digital 14 Oct 26, 2022
This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.

Laravel Verify New Email Laravel supports verifying email addresses out of the box. This package adds support for verifying new email addresses. When

Protone Media 300 Dec 30, 2022
With Laravel, search and lookup Amazon products easily.

Amazon ECS (E-Commerce Services) Package for Laravel If you need the ability to search Amazon's catalog of products or lookup an individual item with

Joe Dawson 51 Aug 4, 2022
Laravel package to search through multiple Eloquent models.

Laravel package to search through multiple Eloquent models. Supports sorting, pagination, scoped queries, eager load relationships and searching through single or multiple columns.

Protone Media 845 Jan 1, 2023
Driver for Laravel Scout search package based on tntsearch

Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

TNT Studio 1k Dec 27, 2022
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

Sérgio Jardim 19 Aug 29, 2022
Simple CRUD + Search using Laravel 8 and Livewire 2

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

PowPow 11 Sep 29, 2022
WIRECRUD 9 adalah aplikasi CRUD + Search sederhana yang dibuat menggukana Laravel 9 dan Livewire 2

WIRECRUD 9 adalah aplikasi CRUD + Search sederhana yang dibuat menggukana Laravel 9 dan Livewire 2. Demo bisa dilihat di YouTube Developow Terbuka jika ingin clone apliaksi sederhana ini untuk belajar, bisa ikuti cara-cara berikut ini.

DeveloPow 11 Nov 25, 2022
SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).

SEO Helper By ARCANEDEV© SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization). Feel free to check out the rele

ARCANEDEV 301 Nov 25, 2022
Send ping to search engine by Index now protocol.

Index now PHP protocol Easy to use protocol that websites can call to notify search engines whenever website contents on any URL is updated or created

Baraja packages 3 Sep 10, 2022
A site which you can apply jobs or search for employees with cool functionalities..

About App An App which you can apply jobs or search for employees with cool functionalities. Some Pics of App Click Image to Zoom in Sign In & Up Empl

Fatih Canbolat 1 Jan 7, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
⚡ Laravel Charts — Build charts using laravel. The laravel adapter for Chartisan.

What is laravel charts? Charts is a Laravel library used to create Charts using Chartisan. Chartisan does already have a PHP adapter. However, this li

Erik C. Forés 31 Dec 18, 2022
Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster.

Laravel Kickstart What is Laravel Kickstart? Laravel Kickstart is a Laravel starter configuration that helps you build Laravel websites faster. It com

Sam Rapaport 46 Oct 1, 2022
Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

Laravel User Activity Log - a package for Laravel 8.x that provides easy to use features to log the activities of the users of your Laravel app

null 9 Dec 14, 2022
Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application.

Laravel Segment Laravel Segment is an opinionated, approach to integrating Segment into your Laravel application. Installation You can install the pac

Octohook 13 May 16, 2022
Laravel Sanctum support for Laravel Lighthouse

Lighthouse Sanctum Add Laravel Sanctum support to Lighthouse Requirements Installation Usage Login Logout Register Email Verification Forgot Password

Daniël de Wit 43 Dec 21, 2022
Bring Laravel 8's cursor pagination to Laravel 6, 7

Laravel Cursor Paginate for laravel 6,7 Installation You can install the package via composer: composer require vanthao03596/laravel-cursor-paginate U

Pham Thao 9 Nov 10, 2022
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

Ollie Codes 19 Jul 5, 2021