Code Monkey home page Code Monkey logo

Comments (13)

qrush avatar qrush commented on May 12, 2024

I like this, but it definitely needs tests. On hold until someone can get around to writing them.

from jekyll.

 avatar commented on May 12, 2024

Hi, I created a branch with tests: http://github.com/Jens-n/jekyll/tree/test_categorynames

from jekyll.

h3h avatar h3h commented on May 12, 2024

Might I humbly suggest category_list instead of categorynames?

from jekyll.

 avatar commented on May 12, 2024

Done: 98a468355fb1ce30b0868400963ea5fc44a66f48

from jekyll.

tomjack avatar tomjack commented on May 12, 2024

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.

 avatar commented on May 12, 2024

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.

tomjack avatar tomjack commented on May 12, 2024

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.

qrush avatar qrush commented on May 12, 2024

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.

qrush avatar qrush commented on May 12, 2024

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.

 avatar commented on May 12, 2024

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.

 avatar commented on May 12, 2024

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.

parkr avatar parkr commented on May 12, 2024

I think we're good on this, no?

from jekyll.

qrush avatar qrush commented on May 12, 2024

This is super old. Closing it down.

from jekyll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.