Can I supply a front matter array to any of these filters: group_by, where, sort? I cannot get the below to work with supplying nav.actual and filtering on the value of that (1.0 in this case)
Iād also try doing the nested front matter outside of the assign as a simpler example to see if it works - adding the assign step is an extra bit of complexity. So just see if you can get the value of nav.actual.
yes, that was the same error as earlier. Thanks for the quick response. Would you mind showing me the nested front matter as you proposed? My entire partial template is below. Does sorting only work with non-collections (posts and data)?
you have a lot of parts. Just saying to start from a simple example and work your way up - for example if you just do {{ nav.actual }} to see the value of it you will find it is not there as it should be page.nav.actual.
where: "nav.actual" I think should be where: page.nav.actual or maybe you need to actually assign that value to something? I think that ānav.actualā is probably being taken literally as a string when you are trying to get it from the front matter right?
What is in site.linux?
edit - I guess I am lost lol. Is nav.actual from the front matter or site.linux? I donāt see where you are using the front matter nav.actual.
ah, ok, maybe I get what you are doing, you have hard coded nav.actual to test, then when it works it would really be getting it from the front matter?
site.linux has many āpagesā in the collection. All pages are represented by a markdown file (e.g. myPage.md, index.md, ā¦). Some of these markdown files have the nav array in their frontmatter.
For example (_linux/articles/index.md):
---
headline: Explore Linux OS
permalink: /linux/articles/
meta:
title: &title Linux Fun
description: &description Linux
keywords: &keywords keywords, here, lots, of, them
og:
title: *title
description: *description
published_time: 2017-03-14
modified_time: &moded 2018-01-04
updated_time: *moded
tag: *keywords
sitemap:
lastmod: *moded
priority: 0.7
changefreq: monthly
exclude: no
nav:
parent: 0
actual: 1.0
sub: 1.1
---
Then, in a template or template partial, Iād like to filter all of the pages in the linux custom collection by the nav.actual #. Say, find all pages in a collection that have nav.actual == 1.0
Does that help paint a better picture than before about how/why Iām trying to sort pages?
Happy to give more insight if Iām explaining this poorly. Thanks for the help thus far.
It seems like it should work, but I guess they have not implementing sorting custom collections with any of those filters ( group_by, where, and sort).
it isnāt the collection part that doesnāt work it was because it was a nested (?) data item - if it had been just nav: 1 or something that was one level it works properly.
Glad it worked! just keep in mind that if statements can slow things down if you use them a lot.