# In a Generator, process a layout on a file fragment

**URL:** <https://talk.jekyllrb.com/t/in-a-generator-process-a-layout-on-a-file-fragment/2906>\
**Category:** Help\
**Created:** [May 14, 2019, 2:31am UTC](https://talk.jekyllrb.com/t/in-a-generator-process-a-layout-on-a-file-fragment/2906 "2019-05-14T02:31:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arghc](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@arghc](https://talk.jekyllrb.com/u/arghc)\
**Post date:** [May 14, 2019, 2:31am UTC](https://talk.jekyllrb.com/t/in-a-generator-process-a-layout-on-a-file-fragment/2906/1 "2019-05-14T02:31:26Z")

</div>

I am processing some files with YAML front matter and wish to output the data into a single file. I’ve written a Jekyll::Generator and can write the HTML directly to a file. I’ve written a different generator where I modify front matter data and let the layout process take its course. But can I, with my file fragments, use layout files to format the chunks, then output the results to a single file?

---

<div class="post-metadata">

**Author:** ![arghc](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@arghc](https://talk.jekyllrb.com/u/arghc)\
**Post date:** [May 14, 2019, 6:56am UTC](https://talk.jekyllrb.com/t/in-a-generator-process-a-layout-on-a-file-fragment/2906/2 "2019-05-14T06:56:33Z")

</div>

I’m still curious about the above idea, but a simpler solution is to put my data (with a generator) into the front matter of each post as a sequence of mappings  
[[https://yaml.org/spec/1.2/spec.html#id2759963](https://yaml.org/spec/1.2/spec.html#id2759963)] (example 2.4)  
[[https://idratherbewriting.com/documentation-theme-jekyll/mydoc\_yaml\_tutorial#example-9-conditions](https://idratherbewriting.com/documentation-theme-jekyll/mydoc_yaml_tutorial#example-9-conditions)]  
then, as front matter data a list can be iterated over with Liquid and can be used to populate `Included` chunks of HTML.
