avillafiorita / jekyll-datapage_gen

Generate one page per yaml record in Jekyll sites.
367 stars 79 forks source link

variable to get the name of data used to generate pages #87

Closed luizeleno closed 3 years ago

luizeleno commented 3 years ago

Hi,

I wonder if there is a way to use a variable that contains the data used to generate the pages. For instance, in _config.yml I have

page_gen:

- data: 'EF'
  template: 'course-page'
  name: 'code'
  dir: 'EF'

And, in the template file, I would like to access the name of the data used, 'EF', like {{page.data}} or something like that. Is that implemented?

Thanks!

luizeleno commented 3 years ago

The idea behind that is that I have several data and I'd like to use the same template file for all of them, but customized by the data names provided in page_gen.

avillafiorita commented 3 years ago

Hi, sorry for taking so long. Yes, it is implemented. You can access the variables exactly like your are mentioning.

Have a look at the _layouts in the example dir, for instance: https://github.com/avillafiorita/jekyll-datapage_gen/blob/master/example/_layouts/book.html

Let me know it it answers your question, so that I can close the issue.

Now that I see the documentation again, it seems like the documentation of this feature has been lost ... so I should probably update the doc to explain the feature. thanks for pointing out.

luizeleno commented 3 years ago

Excellent, thanks for the answer.

All the best, Luiz