'Jekyll collections - custom permalink paths

I've following folder structure:

  • _documentation
    • android
      • app1
        • doc1
        • doc2
      • app2
        • doc3

And inside my config file I've set it up like following:

# Collections
collections:
  documentation:
    output: true
    permalink: /doc/:path/

This of course generates paths like following:

  • ../doc/android/app1/doc1
  • ../doc/android/app1/doc2
  • ../doc/android/app2/doc3
  • ...

What I want is following though:

  • ../android/app1/doc/doc1
  • ../android/app1/doc/doc2
  • ../android/app2/doc/doc3

Question

What I want is a rule like <collection path without file name>/doc/<collection item file name> but as far as I can see there is no way to this, is there?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source