Coder Social home page Coder Social logo

Best way to list folders sorted by x about hyde HOT 3 CLOSED

hyde avatar hyde commented on May 24, 2024
Best way to list folders sorted by x

from hyde.

Comments (3)

 avatar commented on May 24, 2024

So do you want to list nodes or resources?
You can:

{% for n in node.resources|sort(attribute='meta.order') %}
your code here...
{% endfor %}

or if more complex sorting needed you can:

{% set list = [] %}
{% for n in node.resources %}

insert some loop or condition to determine at which index of list to insert current n and:
{% do list.insert(i, n) %}

{% endfor %}
Here you can use your sorted and filtered list.

replace .resources with .child_nodes in order to list nodes

from hyde.

navilan avatar navilan commented on May 24, 2024

Also: If you want to list nodes(folders) - you can use walk method or child_nodes attribute.

Recursive:

{% for node in site.content.walk %}
...
{% endfor %}

(or) One Level:

{% for node in site.content.child_nodes %}
...
{% endfor %}


If both our answers are missing the point, perhaps you can give an example of what you are trying to accomplish?

Also, the user group is a better avenue for such questions than the issue list:
https://groups.google.com/forum/#!forum/hyde-dev

from hyde.

colinsullivan avatar colinsullivan commented on May 24, 2024

Thanks folks! node.resources|sort(attribute='meta.order') is what I was looking for :)

from hyde.

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.