Bulk delete Sitemaps from Google Search Console

I had the pleasure of having to delete several hundreds of sitemaps from different Google Search Console properties (please do not ask for the reason).

I have been directed to this article, written by Chris Gee.

Since I am more of a coder than a Google Sheets user, I opted to create my own little Python script to do the job. And to make your life easier, I decided to share it with you. Am I not a nice person? 😀

Get your bearer token for the GSC API

I have simply followed the steps described by Chris Gee in his article, which is very straight forward.

Step 1: Go to https://developers.google.com/oauthplayground/

Step 2: Choose Google Search Console for the product

Step 3: Choose https://www.googleapis.com/auth/webmasters (NOT readonly)

Step 4: Click the blue „Authorize APIs“ button and log in with the account that has access to the GSC property/ properties you need to access.

Step 5: Click the blue „Exchange authorization code for tokens“ button to get your bearer token

Step 6: After clicking that button, you will see your token in the access_token property of the code.

Copy that access_token – you will need it later in the code.

Set up your environment

Create a new folder on your computer. Also, make sure you have Python installed.

Gather the sitemap URLs you want to delete

In your new folder, create a file called sitemaps_to_delete.txt and paste the URLs of the sitemaps you want to delete. Make sure to double check them, as all sitemaps in this file will be deleted from your GSC property.

Your file should look something like this

https://your-domain.com/sitemap-to-delete-1.xml
https://your-domain.com/sitemap-to-delete-2.xml
https://your-domain.com/sitemap-to-delete-3.xml
https://your-domain.com/sitemap-to-delete-4.xml
....Code-Sprache: JavaScript (javascript)

The Python Script

In the same folder, create a new python file. You can call it delete_sitemaps.py.
Copy and paste the following code into a new python file.

Changes you need to make to this script:

  1. Edit the value of SITEMAPS_FILE to the filename of the file containing the list of sitemap URLs.
  2. Edit the value of BEARER_TOKEN – paste the token your have copied earlier.
import requests
from urllib.parse import quote

SITEMAPS_FILE = "sitemaps_to_delete.txt"

API_URL = "https://www.googleapis.com/webmasters/v3/sites/{site_url}/sitemaps/{sitemap_url}"
BEARER_TOKEN = "YOUR_TOKEN"  # Insert your token here

def delete_sitemap(site_url, sitemap_url):
    encoded_sitemap_url = quote(sitemap_url, safe="")
    url = API_URL.format(site_url=quote(site_url, safe=""), sitemap_url=encoded_sitemap_url)
    headers = {
        "Authorization": f"Bearer {BEARER_TOKEN}",
    }

    response = requests.delete(url, headers=headers)

    if response.status_code == 204:
        print(f"Sitemap has been deleted: {sitemap_url}")
    else:
        print(f"Error while deleting sitemap: {sitemap_url}. Response: {response.status_code} - {response.text}")

def main():
    site_url = input("Insert your GSC property domain (i.e. https://example.com or sc-domain:example.com): ")

    try:
        with open(SITEMAPS_FILE, "r") as file:
            sitemaps = file.readlines()

        for sitemap in sitemaps:
            sitemap_url = sitemap.strip()
            if sitemap_url:
                delete_sitemap(site_url, sitemap_url)

    except FileNotFoundError:
        print(f"File {SITEMAPS_FILE} could not be found.")

if __name__ == "__main__":
    main()
Code-Sprache: PHP (php)

Open your terminal and navigate to your project folder. Then run the command

python delete_sitemaps.pyCode-Sprache: CSS (css)

You will see something like this. Simply enter your GSC property’s domain and hit Enter.

You will see that the sitemaps are getting deleted one by one. The changes should be seen in your GSC property in real time (sitemaps are gone).

Hope this helps. If it does, le tme know in the comments. If you have any additions to the script – also let me know 🙂

Gelöst: Elster „Die Formulardaten sind nicht mehr gültig“ Problem.

Ich habe echt alles probiert. Aber: beim Absenden der Formulare in „Mein Elster“ bekomme ich immer die Fehlermeldung „Die Formulardaten sind nicht mehr gültig“.

Ich hab’s mit Chrome, Firefox und Egde probiert. Keine Chance.

Meine Lösung: Der Opera Browser.

Tatsächlich geht es mit ihm einwandfrei und ohne Probleme.

Hat’s bei Dir auch geklappt? Schreib’s in die Kommentare 🙂

Lösung: Netzlaufwerke verbinden mit unterschiedlichen Benutzerdaten (Video)

Ich hatte heute (mal wieder) das Problem, dass ich Netzlaufwerke mit unterschiedlichen Benutzerdaten auf einem Rechner einrichten muss.
Das Szenario: Ein PC greift mit user1:user1  auf verschiedene Shares zu, soll aber mit user2:user2  auf andere Shares auf dem selben Host zugreifen.

Lösung: Netzlaufwerke verbinden mit unterschiedlichen Benutzerdaten (Video) weiterlesen

Quick Analysis: News websites blocking AI bots

I have wanted to see how many news websites have blocked the AI Bots so far using the Disallow rules.

To get some usefule website data, I have checked on Github and found this repository: news-hub by Pr0gramWizard. It includes an SQL file with a lot of websites and their respective categories.

I have used the data contained within that SQL file and filtered for „news“ websites.

See how many news publishers are blocking AI bots

Find non-lazy-loaded images with ScreamingFrog custom extraction

If you need this, and you’re using ScreamingFrog for this, you know how to use it 🙂 No explanation, no how-to, here’s the regex to use in your custom extraction in ScreamingFrog.

<\s*img(?![^>]*loading)[^>]*src\s*=\s*["']([^"']+)["'][^>]*>Code-Sprache: JavaScript (javascript)

Note: This only works with „simple“ HTML <img> tags, not srcsets. Sorry. This was enough to get the job done for me.

SEO Bookmarklet: Find images without alt attribute

Here’s a quick one for you SEO folks out there.

This browser bookmarklet will highlight all images without an „alt“ attribute and those with an empty alt attribute in red, and download a list of the images.

It will help you get a very quick overview over where the alt attributes are missing, so you can easily edit them without having to check each image manually.

javascript:(function() {
  var images = document.getElementsByTagName('img');
  var highlightedImages = [];

  for (var i = 0; i < images.length; i++) {
    var image = images[i];
    var altText = image.getAttribute('alt');

    if (!altText || altText.trim() === '') {
      image.style.border = '2px solid red';

      var overlay = document.createElement('div');
      overlay.style.position = 'absolute';
      overlay.style.top = image.offsetTop + 'px';
      overlay.style.left = image.offsetLeft + 'px';
      overlay.style.width = image.offsetWidth + 'px';
      overlay.style.height = image.offsetHeight + 'px';
      overlay.style.background = 'rgba(255, 0, 0, 0.5)';
      overlay.style.pointerEvents = 'none';

      image.parentNode.insertBefore(overlay, image);

      highlightedImages.push(image.src);
    }
  }

  console.log('Highlighted Images:', highlightedImages);

  var date = new Date();
  var dateString = date.toLocaleString();

  var content = 'Page URL: ' + window.location.href + '\n';
  content += 'Date and Time: ' + dateString + '\n\n';
  content += 'Highlighted Images:\n' + highlightedImages.join('\n');

  var blob = new Blob([content], { type: 'text/plain' });
  var link = document.createElement('a');
  link.download = 'highlighted_images.txt';
  link.href = URL.createObjectURL(blob);
  link.click();
})();
Code-Sprache: JavaScript (javascript)

I also have a list of really cool SEO bookmarklets – check it out!

How to easily find CSS above the fold for your entire website quickly

Stylesheets included via link tags can cause rendering delays because the browser waits for the CSS to be fully downloaded and parsed before displaying any content. This can result in significant delays, especially for users on high latency networks like mobile connections.

To optimize page loading, PageSpeed recommends splitting your CSS into two parts. The first part should be in-line and responsible for styling the content that appears above the fold (initially visible portion of the page). The remaining CSS can be deferred and loaded later, reducing the impact on initial page rendering.

Optimize your ATF CSS

CSS-Optimierung: Ganz einfach das CSS above-the-fold finden.

Ja, wir wissen alle, dass wir unser CSS optimieren sollten. Das sog. „Crucial CSS“, also die wichtigsten Klassen, sollten wir inline einbauen, und den Rest der Stylesheets deferen. Aber wie findet man einfach die CSS-Klassen, die above the fold genutzt werden?

So einfach geht es mit JavaScript