Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Passing data to templates #29
I'm starting to work with
For some reason, this combination of files does not populate blog.st with the title and text body in second-post.yaml. Instead, it does the following strange thing:
What am I missing here? Or is this a bug? Thanks
Look at this part of index.yaml:
This tells yst to populate the both the
You can fix this, I think, by doing the following in
Then, in your string template, use
Thank you. That doesn't seem to work.
That is, no body and no title. I've also tried:
This prints the string "FROM first post.yaml" at both title and body.
Sorry, I didn't think it through. You're doing something a bit strange. Yst is designed to use yaml files like databases -- so, the files should be yaml lists of objects, not yaml objects as in your case.
Why don't you make each post a string template file, or just a plain markdon file? So, instead of
The main reason is that I was thinking of using a somewhat complicated template, with space for comments, and I thought it would be easier if I had some control over what I was passing to the different parts of the template, as opposed to just a block that includes title, date, body, etc.
I'll try to make it work in the way you suggest. Thanks.