Skip to content

Commit

Permalink
Update sitemap.py
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePrior authored Oct 10, 2024
1 parent 3038d1e commit 1f8b5c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/sitemap.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1f8b5c0

Please sign in to comment.