This repository was archived by the owner on Oct 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
title : My first article
3
3
description : This is a description of my post.
4
+ tags : webdev
5
+ privacy
6
+ python
7
+ backend
4
8
date : 02-02-2023
5
9
---
6
10
This is the content of my ** first** post
Original file line number Diff line number Diff line change 1
1
---
2
2
title : My third article
3
3
description : This is a description of my post.
4
+ tags : gardening
5
+ privacy
4
6
date : 02-02-2023
5
7
---
6
8
This is the content of my ** third** post
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ async def post_list(
24
24
hx_request : str | None = Header (None )
25
25
):
26
26
posts = []
27
+ taglist = []
27
28
28
29
def getPost (post_id : int ):
29
30
try :
@@ -39,6 +40,8 @@ def getPost(post_id: int):
39
40
try :
40
41
post_id = int (post_id )
41
42
post = getPost (post_id )
43
+ if post .get ("tags" ):
44
+ [taglist .append (tag ) for tag in post ["tags" ] if tag not in taglist ]
42
45
posts .append (post )
43
46
except ValueError :
44
47
pass
@@ -76,7 +79,8 @@ def getPost(post_id: int):
76
79
"total_pages" : total_pages ,
77
80
"current_page" : page ,
78
81
"total" : len (posts ),
79
- "pagination" : pagination
82
+ "pagination" : pagination ,
83
+ "tags" : taglist
80
84
}
81
85
82
86
if hx_request :
You can’t perform that action at this time.
0 commit comments