Skip to content

Instantly share code, notes, and snippets.

@supsup
Created October 15, 2019 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save supsup/beb350b9d3becd2b721edea11cb34f4d to your computer and use it in GitHub Desktop.
Save supsup/beb350b9d3becd2b721edea11cb34f4d to your computer and use it in GitHub Desktop.
collection:
- title: "FOO"
collection:
- title: "Zoo"
link: "zoo/"
- title: "ZAM"
link: "zam/"
- title: "BAR"
collection:
- title: "Rad"
link: "rad/"
- title: "Goat"
link: "goat/"
I'm looping over the above data-structure recursively each loop deals with a 'doc'
The first doc would be 'FOO'
It would see that it has a 'collection' so call the function again etc.
currentPage = File.join("/", File.dirname(current_page.path), File.basename(current_page.path, ".*"))
How can I tell if the current doc child contains the currentPage (compared against the doc['link'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment