File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ def generate_sitemap():
13
13
post = frontmatter .load (file_path )
14
14
if 'permalink' in post :
15
15
urls .append (f"{ base_url } /{ post ['permalink' ]} " )
16
+ else :
17
+ # Generate URL from file path if no permalink
18
+ relative_path = file_path .relative_to (Path ("_posts/python" ))
19
+ url_path = relative_path .with_suffix ('' )
20
+ urls .append (f"{ base_url } /python/{ url_path } " )
16
21
except :
17
22
pass
18
23
@@ -21,6 +26,11 @@ def generate_sitemap():
21
26
post = frontmatter .load (file_path )
22
27
if 'permalink' in post :
23
28
urls .append (f"{ base_url } /{ post ['permalink' ]} " )
29
+ else :
30
+ # Generate URL from file path if no permalink
31
+ relative_path = file_path .relative_to (Path ("_posts/python" ))
32
+ url_path = relative_path .with_suffix ('' )
33
+ urls .append (f"{ base_url } /python/{ url_path } " )
24
34
except :
25
35
pass
26
36
You can’t perform that action at this time.
0 commit comments