Closed ninjasort closed 9 years ago
I'll improve the documentation, the first
option allows you to specify a first page override (E.g. using index.html
for the root and /page/:num
every page after). The templating is purely relying on subsequent plugins have enough information to render based on metadata. For metalsmith-in-place
to work, I think there needs to be a special case - I can add an option for contents
and you can specify it.
@cameronjroe Please let me know if the contents
option would enable metalsmith-in-place
. From what I quickly read, it looks like the best solution.
Cool, thanks for the prompt response. I was initially thinking I would be able to specify the path to the template and depending on whether it was in src
or templates
it would render from there. Since I have both the in-place and layouts plugins running, I'd like to handle my looping of posts in the src/blog/index.html
rendered with a layout outside of src
.
Added the pageContents option with v1.2.0
Thanks for adding this. How does this work with metalsmith-in-place? Wouldn't there be a way to simply render the contents of the first
page?
Rendering is best left to the other plugins. With this, it'll set the contents of the file as if it was read from the filesystem and metalsmith-in-place
should "Just Work".
So if I set pageContents: fs.readFileSync('src/writing/index.html')
it works, however it's not utilizing yaml front-matter.
No, it won't be using front-matter - it's purely the contents. For the front-matter, it's pageMetadata
you want to set manually. That gets merged with every page.
Okay, got it working. Thanks.
Hey again. Sorry but this plugin is really challenging me. I'm not getting the path from the the pagination.files
. Any idea why this might be happening?
pagination.files
is just the raw files. Where are the files coming from?
I have a collection of posts:
posts: {
pattern: 'writing/**/*.md',
sortBy: 'date',
reverse: true
}
And have set the pagination:
'collections.posts': {
perPage: 10,
first: 'writing/index.html',
path: 'writing/:num/index.html',
pageMetatdata: {
title: 'Writing',
permalink: 'writing'
},
pageContents: fs.readFileSync('src/writing/index.html'),
layout: 'blog.liquid'
}
Here's an example from my own blog: https://github.com/blakeembrey/blakeembrey.com/blob/master/templates/index.jade. I haven't been using Metalsmith 2, but I didn't think that API changed?
Are there docs anywhere for the params on this plugin? I'm not sure what the
first
parameter does.Also, how does the
template
get rendered? I'm usingmetalsmith-in-place
and I'd like to choose a template from thesrc
dir instead of the roottemplates
orlayouts
.Thanks.