much less grody method of trimming page.path, fixes #1
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d5bbcb36f5
commit
96fcad7f7d
1 changed files with 2 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
{%- comment -%} this is a gross method of converting "_recipes/example.md" to "example". it does it by removing the leading "_recipes/", which is simple enough, and then the trailing ".md", which is done by converting the string to an array, reversing it, turning it back into a string, removing the leading "dm." (".md" backwards), and doing the the array -> reverse -> string shuffle again. it's ugly but hey it works right {%- endcomment -%}
|
{%- comment -%} return everything before the first full stop, without the trailing "_recipes/". for example: "_recipes/file.yml.md" becomes "file" {%- endcomment -%}
|
||||||
{%- assign id = page.path | remove_first: "_recipes/" | split: "" | reverse | join: "" | remove_first: "dm." | split: "" | reverse | join: "" -%}
|
{%- assign id = page.path | split: "." | pop | first | remove_first: "_recipes/" -%}
|
||||||
{%- comment -%} unfortunately we have to iterate through the entire subrecipe folder twice - once to see if there are any subrecipes that apply here, and another time to put them in. thankfully we can break out of the first loop if we find a single match. i miss jinja ;u; {%- endcomment -%}
|
{%- comment -%} unfortunately we have to iterate through the entire subrecipe folder twice - once to see if there are any subrecipes that apply here, and another time to put them in. thankfully we can break out of the first loop if we find a single match. i miss jinja ;u; {%- endcomment -%}
|
||||||
{%- assign applicable_subrecipes = false -%}
|
{%- assign applicable_subrecipes = false -%}
|
||||||
{%- for subrecipe in site.subrecipes -%}
|
{%- for subrecipe in site.subrecipes -%}
|
||||||
|
|
Loading…
Reference in a new issue