Giter Site home page Giter Site logo

Allow sorting by weight/order about zola HOT 7 CLOSED

getzola avatar getzola commented on May 20, 2024
Allow sorting by weight/order

from zola.

Comments (7)

Keats avatar Keats commented on May 20, 2024 1

Hmm, so to fix these warnings, one has to put all non-ordered pages in a separate section?

I think so. i already organise things roughly like that myself: https://gitlab.com/Keats/vincent.is/tree/master/content
An alternative would be putting an attribute in the front-matter to disable the warning but I don't really want to go down the path of adding tons of things there.

Either way, I'll make the warning not too annoying and it should only appear when rebuilding index/section pages so it shouldn't come up too often even if you choose to ignore them.

from zola.

Keats avatar Keats commented on May 20, 2024

Sorting by order rather than weight might make more sense:

1 -> bottom
2 -> above 1
3 -> above 2

The advantage is that adding a new page doesn't require potentially changing weights of other pages unless you want to put something in the middle

from zola.

Keats avatar Keats commented on May 20, 2024

Looks like having _index.md for the homepage will be better than just putting all index specific data in the config

from zola.

Keats avatar Keats commented on May 20, 2024

Homepage _index.md in #45

Frontmatter should have a sort_by that defaults to "date" and can take "order" and "none" as value as well.

Any content without a date or an order (depending on the current section sort_by) will be put at end of the list. The prev/next for those would be kind of random, not sure it's what we want but i don't see a solution other than just ignoring them.
Ignoring them would solve the issue of having static pages mixed with the content in the index page though: for example on my site I have an about and project pages that I don't want to show when iterating on the blog posts or consider at all when paginating/setting prev and next. A warning could be shown if necessary but not for the index page.

from zola.

phil-opp avatar phil-opp commented on May 20, 2024

I have an about and project pages that I don't want to show when iterating on the blog posts or consider at all when paginating/setting prev and next

This seems to be a common problem. Some static site generators solve this by arbitrarily dividing pages into "posts" and "pages". I don't really like this solution because it is inflexible.

A more general solution would be a method to retrieve a section by name. Then we could iterate over all pages of a posts section that is ordered by date and maybe even iterate over pages of a footer section that contains pages like about or contact and has manual ordering.

I don't like the none ordering, since a random ordering would make the output non determistic. Instead we could probably order by e.g. file creation date.

from zola.

Keats avatar Keats commented on May 20, 2024

I don't like the none ordering, since a random ordering would make the output non determistic. Instead we could probably order by e.g. file creation date.

The none is for designing landing pages for example, where you don't want any kind of ordering. It matters if we want to avoid warnings (see below).

A more general solution would be a method to retrieve a section by name. Then we could iterate over all pages of a posts section that is ordered by date and maybe even iterate over pages of a footer section that contains pages like about or contact and has manual ordering.

The index page on gutenberg gets all the sections so that's already doable.
I think pages that don't have dates/order when their section is ordered by date/order should not appear at all. It should display a warning saying this page will not be present because it doesn't have a date/order, unless sort_by is set to none. It will still display a warning in the case of a blog with a couple of non-ordered pages but I think this is ok.

from zola.

phil-opp avatar phil-opp commented on May 20, 2024

The index page on gutenberg gets all the sections so that's already doable

Great!

It will still display a warning in the case of a blog with a couple of non-ordered pages but I think this is ok.

Hmm, so to fix these warnings, one has to put all non-ordered pages in a separate section?

from zola.

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.