{"id":21857581,"url":"https://github.com/hjerpbakk/cloudflare-cache-purger","last_synced_at":"2026-04-19T13:31:12.713Z","repository":{"id":149283473,"uuid":"137881487","full_name":"hjerpbakk/cloudflare-cache-purger","owner":"hjerpbakk","description":"This script clears the cache on Cloudflare and notifies Google when adding a new post to a Jekyll repository.","archived":false,"fork":false,"pushed_at":"2020-04-29T11:39:56.000Z","size":167,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T19:32:14.192Z","etag":null,"topics":["cloudflare","cloudflare-api","cloudflare-cache-purger","dotnet","dotnet-script","google","jekyll","webmaster-tools"],"latest_commit_sha":null,"homepage":"https://hjerpbakk.com/blog/2018/06/20/clear-cloudflare-cache","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hjerpbakk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-19T11:20:28.000Z","updated_at":"2021-07-10T19:58:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c782c60-5ae7-4f45-abf4-6a637296f220","html_url":"https://github.com/hjerpbakk/cloudflare-cache-purger","commit_stats":null,"previous_names":["hjerpbakk/cloudflare-cache-purger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hjerpbakk/cloudflare-cache-purger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjerpbakk%2Fcloudflare-cache-purger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjerpbakk%2Fcloudflare-cache-purger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjerpbakk%2Fcloudflare-cache-purger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjerpbakk%2Fcloudflare-cache-purger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hjerpbakk","download_url":"https://codeload.github.com/hjerpbakk/cloudflare-cache-purger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjerpbakk%2Fcloudflare-cache-purger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudflare","cloudflare-api","cloudflare-cache-purger","dotnet","dotnet-script","google","jekyll","webmaster-tools"],"created_at":"2024-11-28T02:30:05.644Z","updated_at":"2026-04-19T13:31:12.695Z","avatar_url":"https://github.com/hjerpbakk.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare Cache Purger\n\n## What it does\n\nThis script purges relevant pages from the cache on Cloudflare when adding a new post to a Jekyll repository. In addition to the tag pages matching the tags of the latest post and the post itself, it purges the following hardcoded pages:\n\n- .\n- . /feed.xml\n- . /sitemap.xml\n- ./archive\n\n`sitemap.xml` is also submitted to Google so that the new content is crawled quicker.\n\n## Running locally\n\n```bash\n$ dotnet script main.csx -- path_to_jekyll_repo\n```\n\n## Running from GitHub\n\n```bash\n$ dotnet script https://raw.githubusercontent.com/Sankra/cloudflare-cache-purger/master/main.csx -- path_to_jekyll_repo\n```\n\nCaution, do not run scripts from the Internet that you do not fully understand.\n\n## Configuration\n\nThe script takes one argument. This is the `path to the Jekyll repo`.\n\nIf a `config.json` file is added to the same directory, the script will try to actually purge the cache. If this file is missing, the script only prints what it would’ve done.\n\n`config.json` should look like this:\n\n```JSON\n{\n   \"baseAddress\": \"[baseAdress]\",\n   \"cloudflareApiKey\": \"[cloudflareApiKey]\",\n   \"cloudflareEmail\": \"[cloudflareEmail]\",\n   \"cloudflareZoneId\": \"[cloudflareZoneId]\"\n}\n```\n\n- `baseAdress` is the URL to your site.\n- `cloudflareApiKey` is your Cloudflare API key. You can see this on your *profile*.\n- `cloudflareEmail` is the email to your user on Cloudflare.\n- `cloudflareZoneId` is the id of this site on Cloudflare. You can see this in the *overview* tab for your site.\n\n## Dry run\n\nIf the script cannot find `config.json`, the generated paths will only be written to standard out. The default site is `https://hjerpbakk.com`, but this can easily be changed to your domain within the script.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"dry-run.png\" width=\"682\" alt=\"Example from a local dry run\" /\u003e\n\u003c/p\u003e\n\nA dry run can also be forced by using a second argument:\n\n```bash\n$ dotnet script main.csx -- path_to_jekyll_repo dry_run\n```\n\n## Clear Cloudflare cache\n\nTo use this with Cloudflare, clone the repo, create `config.json` from `config.default.json` and input your configuration values.\n\nRunning the script now will call the Cloudflare API and do the needful.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"cloudflare-clear.png\" width=\"682\" alt=\"Example clearing the Cloudflare cache\" /\u003e\n\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhjerpbakk%2Fcloudflare-cache-purger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhjerpbakk%2Fcloudflare-cache-purger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhjerpbakk%2Fcloudflare-cache-purger/lists"}