Skip to content
Permalink
Browse files
Sort JSON keys (compression gains)
  • Loading branch information
da2x committed Aug 6, 2015
1 parent e0410d0 commit 508572abe4ae9e7ffd8d89de8fe62c7703f57601
Showing 2 changed files with 5 additions and 5 deletions.
@@ -4,7 +4,7 @@ Module = recent_posts_json

[Documentation]
Author = Daniel Aleksandersen
Version = 0.9.0
Website = https://www.aeyoun.com
Version = 1.0.0
Website = https://www.aeyoun.com/projects/nikola/
Description = Generate JSON with recent posts.

@@ -95,14 +95,14 @@ def make_json(self, posts, descriptions, previewimage, output_path):
link = post.permalink(absolute=False)
title = post.title()
entry = {"date": date,
"title": title,
"loc": link}
"loc": link,
"title": title}
if descriptions:
entry.update({["desc"]: post.description()})
if previewimage:
entry.update({["img"]: post.previewimage()})
recent_posts.append(entry)
data = json.dumps(recent_posts, indent=2)
data = json.dumps(recent_posts, indent=2, sort_keys=True)
with io.open(output_path, "w+", encoding="utf8") as outf:
outf.write(data)

0 comments on commit 508572a

Please sign in to comment.