Closed k94ll13nn3 closed 8 years ago
Thanks a lot for your interest in pretzel, I see that you already have a nice collection of Pretzel plugins! :smiley:
Sadly the ITransform
is out of the generation process and have neither Liquid or Razor engines.
I haven't got the time to test but I think you have 2 short term solutions:
Template.FileSystem = new Includes(siteContext.SourceFolder, FileSystem);
followed by var template = Template.Parse(templateContents);
var output = template.Render(data);
where templateContents
is the content of your category page and data
a Hash
with your data (here layout and category).
But it could be interesting to have access to the current ISiteEngine
in the ITransform
, by example by passing it in the Transform
method. If you are interested by making a PR we can discuss how to do it and what methods of ISiteEngine
should be made public.
Another solution could be to add some extensibility points to SiteContextGenerator
, before and after the posts/pages/tags/categories generation.
This would allow to add some pages/posts to the site context.
I have not been able to make the Template
solution worked on a global level (I have something working but only for my setup).
I will try to take a look at the ISiteEngine
solution when I manage to have some free time.
Fixed by #288
I am currently trying to create a category generator plugin for Pretzel and I am facing some problems. I understood that in order to generate files, I had to create a class that inherits
ITransform
. I am able to recover all the categories in my site withsiteContext.Categories
and create empty files according to each category.Next to that I have a
category_index.html
file in the_layouts
folder that will be the layout for all my category pages. Thanks to that layout, i can manually create a category page by having a file with only the following content :The problem is that I want my plugin to generate and render those files and I don't know how to do it. I tried to use some functions from
DotLiquid.Template
and I took a look atJekyllEngineBase.cs
in order to understand the process but none of my attempts worked.Is there a way to render a page with a layout in a Pretzel plugin ?