Skip to content

IndexNow Action

Compare
Choose a tag to compare
@bojieyang bojieyang released this 13 Mar 09:05
· 114 commits to main since this release
v1
054229e

A GitHub Action that automatically submits URLs to participating search engines through the IndexNow protocol.

Usage

Prerequisites

The key file has been obtained from IndexNow and added to your website.

If you don't know how to get the key file, see IndexNow Document.

Basic

steps:
  # v1 is the latest major version following the action-versioning guide.
  - uses: bojieyang/indexnow-action@v1
    with:
      sitemap-location: "https://example.com/sitemap.xml" # your sitemap location, must start with http(s).
      key: ${{ secrets.INDEXNOW_KEY }} # The key you get from IndexNow.

Examples

A complete example used in my blog shows below:

name: "IndexNow"
on:
  schedule:
    # Set the schedule time
    - cron: "0 2 * * *"

jobs:
  check-and-submit:
    runs-on: ubuntu-latest
    steps:
      - name: indexnow-action
        uses: bojieyang/indexnow-action@v1
        with:
          sitemap-location: "https://bojieyang.github.io/sitemap.xml"
          key: ${{ secrets.INDEXNOW_KEY }}

View code from here.

Inputs

  • sitemap-location
    required.
    The location of sitemap file in your website. Must start with https or http(e.g., https://example.com/sitemap.xml).

  • key
    required.
    The IndexNow key that you get from search engines.

    Note DO NOT stored as plaintext in the workflow file. Use GitHub Secrets instead.
    More about GitHub Secrets, see Encrypted Secrets.

  • key-location
    optional.
    Location of the IndexNow key file that you customed.
    If not set, it will assume that there is a file named {your-indexnow-key}.txt in the root directory of the website(e.g., https://example.com/{your-indexnow-key}.txt).

    Note DO NOT stored as plaintext in the workflow file. Use GitHub Secrets instead.
    More about GitHub Secrets, see Encrypted Secrets.

  • since
    optional.
    The lastmod field in the sitemap that for past {n} {since-unit} will be submit. The default value is 1.

  • since-unit
    optional.
    The unit of since. Available units are minute, hour, day, week, month and year. The default value is day.

  • endpoint
    optional.

    The endpoint of a special search engine. Available units are api.indexnow.org, www.bing.com, search.seznam.cz and yandex.com. For more details, see: IndexNow FAQ. The default value is www.bing.com.

  • limit
    optional.
    The upper limit for submitting URLs. The default value is 100.

  • timeout
    optional.
    The timeout both fetch sitemap and submit to the search engine in milliseconds. The default value is 10000 (10 seconds).

  • failure-strategy
    optional
    Define the strategy when submit failed. Available strategy are ignore and error.
    For ignore, will outputting an notice only.
    For error, outputting an error message also sets the status of action to fail. The Default value is ignore.

Maintainers

@bojeyang

Acknowledgements

Use @seantomburke/sitemapper to fetch and parse sitemap.

Contributing

Contributions are welcome! Please create an issue and if applicable, a design before proceeding with code.

License

The scripts and documentation in this project are released under the MIT License