Comments (13)
I like this, but it definitely needs tests. On hold until someone can get around to writing them.
from jekyll.
Hi, I created a branch with tests: http://github.com/Jens-n/jekyll/tree/test_categorynames
from jekyll.
Might I humbly suggest category_list
instead of categorynames
?
from jekyll.
Done: 98a468355fb1ce30b0868400963ea5fc44a66f48
from jekyll.
Why not rework site.categories to accomplish this? So we can do like:
{% for category in site.categories %}
<h2>{{ category.name }}</h2>
{% for post in category.posts %}
...
from jekyll.
Initially I just needed a small fix for my site. A one-liner seemed like a good-enough solution for the time being. I initially even set out to implement Thomas idea but was too lazy, so I stuck with the one-liner.
That said, I think that a bit of re-modeling might benefit jekyll in the future (i.e. decoupling filesystem layout and reading from content transformation, changing Topic and Category into real objects, etc.).
from jekyll.
I was able to make the snippet in my last comment work, but in order to keep site.categories.foo
working, I had to make a Categories class that acts both like a hash (mapping category names to Post arrays) and like an array of Category objects (through each
).
This seems like it would become more of a problem if categories ever get more data. I'd like to be able to someday do:
{{ category.name }}
and have it link to an automatically generated _site/[category]/index.html. But if site.categories.foo
is an array of posts, the extra category data won't be accessible from it.
Maybe we could change site.categories.foo
to site.categories.foo.posts
?
from jekyll.
Alright, now that tags are in master I think it's time to address this issue. I like tomo's idea but I need to play around with this more. If you've got other suggestions pipe up!
from jekyll.
If this was to be refactored, I think it would need to degrade gracefully. For instance I think at least until 0.6.0 or 0.7.0 the site
object would have to work as normal. There could then be a new object, perhaps jekyll
or another name that makes sense with the refactored payload.
Or maybe this could be done through a config value... payload: new
and default to old, print out plenty of warnings in the meantime.
from jekyll.
I really like tomos idea. I like to have a strong domain model at the heart of my programs and his idea goes along the same lines. My suggestion is: Follow tomo and drop site.categories.foo
in favor of site.categories.foo.posts
.
from jekyll.
Btw: I created a wiki page (http://wiki.github.com/mojombo/jekyll/thoughts-about-a-new-version ) that discusses API-breaking changes. Please contribute to the page.
from jekyll.
I think we're good on this, no?
from jekyll.
This is super old. Closing it down.
from jekyll.
Related Issues (20)
- [Bug]: Quickstart minimal example gives: ERROR, Invalid date HOT 4
- [Docs]: Remove my entry from the Wiki Sites HOT 4
- [Docs]:
- [Bug]: Error: undefined method `excerpt_separator' for #<Jekyll::Page> HOT 36
- [Bug]: Following the instructions on the home page results in "cannot load such file -- json (LoadError)" HOT 3
- No me funciona disqus en mi pΓ‘gina HOT 1
- [Bug]: "undefined method `yaml_file?' for #<Jekyll::page @name="404.md"> in /_layouts/single/html HOT 16
- I initially had logic that was a lot more tolerant of `s`s. And then I ran into the [π₯ π - potato bug](https://github.com/check-spelling/check-spelling/releases/tag/0.0.17-alpha) -- namely the plural of `potato` is not `potatos`. It was so embarrassing, since I learned the proper spelling in elementary school. It was also a big deal as a [Vice President suggested `potatoe` to a student](https://abcnews.go.com/Politics/video/june-15-1992-dan-quayle-misspells-potato-48017343).
- [Docs]:
- [Bug]: Unable to build website
- [Bug]: `permalink_ext': undefined method `end_with?' for {}:Hash
- [Bug]: error running "bundle exec jekyll s" HOT 4
- [Bug]: related_posts prefers longer articles
- [Bug]: Can't serve website due to sass-embedded version HOT 5
- [Bug]: Jekyll release v3.9.5 is missing from GitHub, only exists in ruby gems HOT 1
- feat:
- [Bug]: Obsolete nodeJS version HOT 1
- [Bug]: Empty include parameter when assign a forloop attribute to it.
- Unquoted language code "no" not recognized in _config.yml HOT 1
- [Bug]: pipe character to single row table priority unexpectedly high
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jekyll.