-
Notifications
You must be signed in to change notification settings - Fork 648
Sort boards by date in the rss feed #1356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously a date was OK if it could be parsed; now it's only OK if frontmatter thinks it's a date. I'm not 100% that this is the same as jekyll, but we'll go with it for now.
Is this an alternative to #1355 or a continuation of that? |
This also reformats all front matter due to how the file is processed. The transformation was done with ```py import datetime import sys import frontmatter for i in sys.argv[1:]: post = frontmatter.load(i) date_added = post.get("date_added", "") if isinstance(date_added, str): try: date_added = datetime.datetime.strptime(date_added, "%Y-%m-%d").replace(hour=12) except ValueError as exc: print(f"Failed to parse date {date_added} in {i}: {exc}") elif isinstance(date_added, datetime.date): date_added = datetime.datetime.combine(date_added, datetime.time(hour=12)) post["date_added"] = date_added with open(i, "wb") as f: frontmatter.dump(post, f) f.write(b"\n") # Re-add trailing newline ```
The fix in #1355 was incomplete, because it still places all blinka boards below all circuitpython boards. Also, we can do better at checking that dates are in a format that jekyll will be able to properly sort. |
Normally, the RSS reader handles the sorting and I'm certain this was the case when it was initially tested. The reason Blinka boards are placed separately from the CircuitPython boards is because they are under their own category via RSS. |
This PR does maintain the tag while mixing the two lists together. |
I tested this out locally and it does look like it's working successfully to me. The contents of the local RSS are now intermixed and represent reverse chronological order of release. This does feel like it's most correct to my mind, I would be in favor of merging this change. With that being said, practically speaking inside of "FeedR" (Android RSS reader app) it doesn't seem to make a difference. Both the local feed from this branch, and the currently live feed on the real site are sorted basically the same. It appears to be respecting the It does look there are other changes made to the formatting of the data files as well like removing quotes. If we do merge this we should probably update the guide p 8000 age here: https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads to reflect the updated syntax standards. |
My main concern with this change is adding the time on there making it more difficult to maintain. Is there a way to do it without adding the 12:00 on there? |
I can try it without the 12:00s. |
The fix in #1355 was incomplete, because it still places all blinka boards below all circuitpython boards. Also, we can do better at checking that dates are in a format that jekyll will be able to properly sort.
This also reformats all front matter due to how the file is processed. :-/ I could spend more time to make a more minimal change, if that's desirable.
The transformation was done with