@@ -17,23 +17,20 @@ def generate_sitemap_for_language(posts_dir, url_prefix, output_dir, reference_d
17
17
# Skip files in redir directory
18
18
if "redir" in file_path .parts :
19
19
continue
20
- try :
21
- post = frontmatter .load (file_path )
22
- if 'permalink' in post :
23
- permalink = post ['permalink' ]
24
- # Use permalink as-is if it has a domain, otherwise prepend base_url
25
- url = permalink if permalink .startswith (('http://' , 'https://' )) else f"{ base_url } /{ permalink .lstrip ('/' )} "
26
- # Skip dash.plotly.com URLs
27
- if 'dash.plotly.com' in url :
28
- continue
29
- # Skip chart-studio URLs
30
- if 'chart-studio' in url :
31
- continue
32
- # Only include URLs that start with the specified prefix (with or without leading slash)
33
- if permalink .startswith (url_prefix ) or permalink .startswith (f"/{ url_prefix } " ):
34
- urls .append (url )
35
- except Exception as e :
36
- pass
20
+ post = frontmatter .load (file_path )
21
+ if 'permalink' in post :
22
+ permalink = post ['permalink' ]
23
+ # Use permalink as-is if it has a domain, otherwise prepend base_url
24
+ url = permalink if permalink .startswith (('http://' , 'https://' )) else f"{ base_url } /{ permalink .lstrip ('/' )} "
25
+ # Skip dash.plotly.com URLs
26
+ if 'dash.plotly.com' in url :
27
+ continue
28
+ # Skip chart-studio URLs
29
+ if 'chart-studio' in url :
30
+ continue
31
+ # Only include URLs that start with the specified prefix (with or without leading slash)
32
+ if permalink .startswith (url_prefix ) or permalink .startswith (f"/{ url_prefix } " ):
33
+ urls .append (url )
37
34
38
35
# Remove duplicates and sort
39
36
urls = sorted (set (urls ))
0 commit comments