Medusa Free Collections - No Hardcode
In Nyiblorong version, collection was hardcoded to posts only. In Medusa V2.1.0, we implement style free collections.
How it works:
scan_content() scans content/ recursively:
content/posts/→collections['posts']content/posts/medusa/→collections['posts/medusa']+collections['posts']._subs['medusa']content/projects/→collections['projects']
All exposed to Jinja as direct vars: ,, ``
Python Slicing:
for post in posts.medusa[:3]
Latest 3 medusa posts!
endfor
This uses CollectionList class that supports __getitem__ slice!
Filters:
| limit(3)→[:3]| slice(3)→[:3]| where("featured", true)→ filter by field| filter_tag("python")→ filter by tag
Sort Free:
In content/blog.md:
sort_by: date # or title, featured, category, author
sort_order: desc # asc / desc
No more hardcoded date only!
This is inspired by Eleventy (11ty) and jekyll but implemented in Python with zero dependencies.
Axcora Technology
Axcora Technology is a software development company that specializes in creating innovative solutions for businesses and individuals. We are dedicated to delivering high-quality software products and services that meet the unique needs of our clients.
Visit Axcora