diff --git a/code/sitemap.py b/code/sitemap.py index b3f43482ed..06f0c26218 100644 --- a/code/sitemap.py +++ b/code/sitemap.py @@ -1,6 +1,7 @@ import xml.etree.ElementTree as ET from datetime import datetime import utils +from urllib.parse import quote def generate_sitemap(json_file, output_file): # Load suburbs data from JSON file @@ -16,8 +17,9 @@ def generate_sitemap(json_file, output_file): for state, suburbs in data.items(): for suburb in suburbs: suburb_name = suburb['name'] + encoded_suburb = quote(suburb_name.lower().replace(' ', '-')) processed_date = suburb['processed_date'] - url = f"https://nbn.lukeprior.com/?suburb={suburb_name.lower().replace(' ', '-')}&state={state.lower()}" + url = f"https://nbn.lukeprior.com/?suburb={encoded_suburb}&state={state.lower()}" add_url(urlset, url, processed_date) # Convert the XML tree to a string