From ea1ae752514227bd0af0be130d5ea9e36f9a60cc Mon Sep 17 00:00:00 2001 From: Meekdai Date: Wed, 22 Nov 2023 12:15:37 +0800 Subject: [PATCH] =?UTF-8?q?docs=E5=86=85json=E6=96=87=E4=BB=B6=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 6 +++++- templates/tag.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gmeek.py b/Gmeek.py index 6876c21..bf19fdc 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -313,6 +313,10 @@ else: listFile=open("blogBase.json","w") listFile.write(json.dumps(blog.blogBase)) listFile.close() -shutil.copy("blogBase.json",blog.root_dir) +# shutil.copy("blogBase.json",blog.root_dir) +blog.blogBase["postListJson"]=dict(sorted(self.blogBase["postListJson"].items(),key=lambda x:x[1]["createdAt"],reverse=True))#使列表由时间排序 +docListFile=open(blog.root_dir+"postList.json","w") +docListFile.write(json.dumps(blog.blogBase)) +docListFile.close() ###################################################################################### diff --git a/templates/tag.html b/templates/tag.html index 03c7ac4..bf335dd 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -68,7 +68,7 @@ document.getElementById("{{ blogBase['singeListJson'][num]['postTitle'] }}").set tagList=[]; jsonData=''; -let requestJson="blogBase.json" +let requestJson="postList.json" let request=new XMLHttpRequest(); request.open("GET",requestJson); request.responseType='text';