Comments (13)
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.
from metalsmith-pagination.
@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.
from metalsmith-pagination.
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
.
from metalsmith-pagination.
Added the pageContents option with v1.2.0
from metalsmith-pagination.
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?
from metalsmith-pagination.
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".
from metalsmith-pagination.
So if I set pageContents: fs.readFileSync('src/writing/index.html')
it works, however it's not utilizing yaml front-matter.
from metalsmith-pagination.
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.
from metalsmith-pagination.
Okay, got it working. Thanks.
from metalsmith-pagination.
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?
from metalsmith-pagination.
pagination.files
is just the raw files. Where are the files coming from?
from metalsmith-pagination.
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'
}
from metalsmith-pagination.
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?
from metalsmith-pagination.
Related Issues (20)
- Automatically generate index.html pages when not specified in path property HOT 10
- add page metadata to pagination.files
- Switching to metalsmith-layouts HOT 1
- Plugin creates index.html files, but there is no content in them HOT 3
- path option arguments don't work correctly HOT 5
- Not overwriting files HOT 1
- I can't get your plugin to work HOT 19
- metalsmith-templates is deprecated. HOT 2
- Plugin throws TypeError if collection doesn't exist HOT 4
- Contentful Integration HOT 7
- Contents writing fully templated data? HOT 2
- How to use pagination with full article contents and not snippets? HOT 5
- Path fields is not populated correctly with [email protected] HOT 5
- If pageContents is a string, you get undefined behavior. HOT 2
- Automatically generate pagination from collections? HOT 1
- pagination object not being read from pug template HOT 1
- how use the pagination with handlebars template HOT 10
- Does not allow omission of template and layout options
- Generate pagination from empty collection HOT 2
- how to add next and previous button along with some page number in pagination using javaScript. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metalsmith-pagination.