Skip to content

Commit

Permalink
Sort JSON keys (compression gains)
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed Aug 6, 2015
1 parent e0410d0 commit 508572a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions v7/recent_posts_json/recent_posts_json.plugin
Expand Up @@ -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.

6 changes: 3 additions & 3 deletions v7/recent_posts_json/recent_posts_json.py
Expand Up @@ -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)

Expand Down

0 comments on commit 508572a

Please sign in to comment.