2

Jekyll by default uses specified variables to generate permalink. But in my case I need permalink to use page specific variable like chapter to generate url something like /chapters/:chapter instead of using date and other stuff

rocambille
  • 15,398
  • 12
  • 50
  • 68
ducktyped
  • 4,354
  • 4
  • 26
  • 38

1 Answers1

4

You can't use any front matter variable to create your permalinks, only the Jekyll defined keys for the type of page.

To get the URLs you're after, you could use collections, as Wickramaranga said. In your _config.yml, you define your chapters collection:

collections:
  chapters:
    output: true
    permalink: /chapters/:title/

Then create your chapters, e.g. /_chapters/1.md, /_chapters/2.md.

That'd create http://localhost:4000/chapters/1/ and http://localhost:4000/chapters/2/

Ross
  • 2,701
  • 16
  • 25