Closed evanmiller closed 7 years ago
Hi @evanmiller, can you share an example of a structure you want to support? You can now do something like this:
---
related_pages:
- page: about
- page: blog/fiji
- page: https://www.perl6.org
nested:
- deep_pages:
- page: blog/fiji
- page: about
categories:
- vacation:
- vacation_pages:
- page: index
- page: about
- page: blog/fiji
- road_trips:
- road_trip_pages:
- page: pacific_northwest
- page: australia
- page: africa
---
I'm looking for:
categories:
- title: General tasks
category_pages:
- page: compute/categories
- page: compute/survival_times
- page: summary/covariate_partition
- page: tables/row_multipliers
I updated Uzu, but this still doesn't seem to be working.
This structure should work, I just did a copy / paste test and it looks like it is working. Maybe test a full uzu reinstall again. You can access it from {{ category_pages }}
.
To be clear I want to access it like:
{{#categories}}
<em>{{ title }}</em>
{{#category_pages}}
<li>{{ title }}</li>
{{/category_pages}}
{{/categories}}
Should that work? If so I will reinstall and test again.
This would work:
{{#categories}}
<em>{{ title }}</em>
{{/categories}}
{{#category_pages}}
<li>{{ title }}</li>
{{/category_pages}}
category_pages
should not be a top-level variable. It should remain an attribute of categories
. I want to do something like:
categories:
- title: General tasks
category_pages:
- page: compute/categories
- page: compute/survival_times
- page: summary/covariate_partition
- page: tables/row_multipliers
- title: Other tasks
category_pages:
- page: compute/duration
- page: tables/delete
I understand what you are after now. I'll let you know when I have something working to test.
This should work now. But I did a bit of an overhaul on the way these are parsed so let me know if it has impacted any of your other variables. Also improved stability and error handling somewhat.
Hi, this is still not working as expected.
---
categories:
- title: General tasks
- category_pages:
- page: compute/categories
- page: compute/survival_times
- page: summary/covariate_partition
- page: tables/row_multipliers
---
{{#categories}}
<p><strong>{{ title }}</strong></p>
<ul>
{{#category_pages}}
<li><a href="{{ layout.url_prefix }}{{ topic }}{{ layout.url_separator }}{{ anchor }}{{ layout.url_postfix }}">{{ title }}</a></li>
{{/category_pages}}
</ul>
{{/categories}}
Output:
<p><strong>General tasks</strong></p>
<ul>
</ul>
Hi @evanmiller, it seems to work for my tests. I tested with both of these structures:
---
categories:
- title: General tasks
- category_pages:
- page: compute/categories
- page: compute/survival_times
- page: summary/covariate_partition
- page: tables/row_multipliers
---
and
---
categories:
- title: General tasks
category_pages:
- page: compute/categories
- page: compute/survival_times
- page: summary/covariate_partition
- page: tables/row_multipliers
---
also, I upped the version to 0.2.2
, can you confirm that this is the latest?
Ah, looks like I was creating two hashes on accident. It's working now. Thanks!
Excellent. Hope it helps with your site.
[master b284e28] Move link hierarchy to YAML
2 files changed, 71 insertions(+), 121 deletions(-)
Much better :-D
That is great. Very cool to see that.
It appears the
*_pages
expansion only works for top-level variables. I have some pages with nested hierarchies of links (e.g.categories/subcategories/sub_pages
); it would be great if the algorithm could be applied to nested variables/attributes as well as top-level ones.