I have a small site that is hosted by Github pages. The content – markdown files – are stored in one directory and on push that directory the site is built and deployed to the <myname>.github.io
repository for hosting on GitHub pages. This works well.
Now I want to implement IndexNow functionality, so that I don’t need to manually submit a sitemap each time I post an update. Since both Google and bing no longer allow this to be done automatically, it’s a step I often forget. It looks like at least Bing utilizes this functionality – I’m still looking for an automatic alternative for Google.
In any case, I found a GitHub Action that claims to perform this submission automatically. Part of utilizing this functionality is that I need a file on my site that is my key, with the key inside the file, for the search engine to verify against the submitted key. The action proposes using this snippet in the build job
jobs:
build:
steps:
### ... omit other steps
- name: Setup IndexNow
# Generate files dynamically to prevent them from being leaked in public repositories.
# This example will put the file in the root directory of the site.You may change the location by yourself.
run: echo ${{ secrets.INDEXNOW_KEY }} > ${{ secrets.INDEXNOW_KEY }}.txt
### ... omit other steps
So, if I do this before I push the code for final deployment to GitHub pages my problem is this: This still puts a file into the <myname>.github.io
repository, which is public, for all to see on GitHub.
Is it possible to do what this action – and IndexNow documentation – requires? I need that file with the key name and value to match a key that is submitted to the API on my host. Since the repository for Github pages is public, I don’t know a more secure way to accomplish this.