-
Notifications
You must be signed in to change notification settings - Fork 1.7k
No way to order post or pages #42
Comments
Some time ago I did this for category names. It works locally but it's not an option when using Github pages. In Github it seems that _config.yml is updated by merging any new change with the old values. When using {{ site.array }} the order is not guaranteed to be the same as in _config.yml |
@abyme that is a very good point and also explains why that happend to me a couple times =). This makes it even harder to get proper ordering in Jekyll =/ |
It's not possible without plugins as far as I know. I currently list categories manually in a included template. There is a way (at the end of that post) to do it, but it's possibly the worst hack ever. |
Concerning Github Pages: It is definitely the timestamp of the static I wanted to order my website navigation but still use the following Jekyll-Bootstrap snippet (so that the
I tried the following to achieve an ordering:
So, is there any possibility to get a custom ordering of the navigation and pages? It is definitely a huge drawback. The only solution I see is to remove the Jekyll-Bootstrap code above and hardcode the navigation within the |
@FlorianWolters yep I agree, it is very annoying not being able to preserve order. You may or may not really like this answer but after spending much time working on Jekyll Bootstrap, the next step in its evolution is ... re-design how a static blogging generator can work. http://ruhoh.com is my project, it naturally supports ordered lists. The neat thing about ruhoh is all posts and pages have ids. Throughout the system you can reference the post/page by id, for example create an array of page ids, then the templater is smart enough to expand the id to the relevant post/page object. It's outlined here: http://ruhoh.com/usage#to_pages |
@plusjade I appreciate your fast answer and your work on both static blogging generators. I definitely like your answer and I will give Ruhoh a try. Can you tell me something about the future of Jekyll-Bootstrap? Will you continue both projects or will Ruhoh supersede Jekyll-Bootstrap and the latter will be discontinued? Nonetheless, you should clarify the future of Jekyll-Bootstrap on http://jekyllbootstrap.com. |
I will be committed to maintaining JB but work will be relegated to weekends mostly. I created JB from my initial frustrations working with Jekyll. Most people praise Jekyll's ease of use but for me it took a lot of effort to grok how and why Jekyll was doing what it was doing. The biggest pain point for me as a programmer is shoehorning my mind into Liquid. I get why liquid is useful, but to a programmer on his own machine, it's blasphemy. Jekyll is great because it popularized and solidified static blogging as a viable alternative. This is of course because Jekyll is made by GitHub and natively supported by GitHub. Moving forward, I reflected on why I made JB in the first place. It was to help myself blog more. I've had many Wordpress sites, a posterous site, a sinatra site, and they all achieve the same thing - nothing. I never write in them. I realized the workflow was not motivating to me. If my goal is to help people blog more, then prioritizing Jekyll-Bootstrap development has on fatal flaw - no matter how feature-rich, intuitive and awesome JB gets, it will only ever be useful to ruby programers. What to do? There are countless other static blog generators out there, so I have to ask myself is making another one a good idea? http://ruhoh.com is the only one I know of built to be language-agnostic. The api is heavily influenced by Jekyll and I'd argue using Mustache for templating is 54.67 trillion times better and easier than using Liquid. Mustache is of course supported in many languages So to answer your question officially - I think the best use of my time, relative to my goal of empowering all developers to share their knowledge through blogging, is to commit to building a language-agnostic Universal Blogging API. Lastly, I definitely agree about making my intentions clear on jekyllbootstrap.com. I'm just finishing up my hosting service for ruhoh, so as soon as I get the ruhoh.com site a bit more officialized, I'll update JB with a well-intentioned outline of the future of both products. @FlorianWolters I appreciate the relevant questions and could use some feedback on what you think from a user perspective? Are you interested in trying out ruhoh's hosted service? username.ruhoh.com, just like GitHub - preview here |
I thought maybe one can add another tag to the header of .md file. Similar to EDIT: found solution here: http://stackoverflow.com/questions/9053066/sorted-navigation-menu-with-jekyll-and-liquid |
This worked for my purposes: http://stackoverflow.com/a/9126294/1199685 |
This works for me:
Then add numerical prefixes to file names to order them. Optionally fix permalinks:
|
I wanted to use the custom array solution, and I struggled to find out the fields needs. Finally I came out with this, in _config.yml, add:
user your custom array inside default.html:
|
@snowdream 👍 |
I think something like this should work. I tested it locally and all seems well. JB/sort_collection
I plan to create a PR for this tonight. Offering up for peer review.
|
Stand-alone helper. Low risk. Merging. Addresses issue #42.
Merged. Low risk. Stand-alone helper file. |
… hashes, ascending or descending.
I notice people search for how to order page and post lists in Jekyll Bootstrap. Just so there is a place where this question is answered:
There is currently no way to pragmatically order pages or posts.
The posts are ordered chronologically, while the pages are ordered alphabetically (to my knowledge).
The only way to create your own order is to manually create an array in the _config.yml or YAML Front Matter pointing to the post/page urls, then iterate over that array.
This is one of the biggest drawbacks to sticking with the Jekyll framework. I'm currently scheming a solution for this =)
The text was updated successfully, but these errors were encountered: