Code Monkey home page Code Monkey logo

Comments (13)

blakeembrey avatar blakeembrey commented on August 22, 2024

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.

blakeembrey avatar blakeembrey commented on August 22, 2024

@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.

ninjasort avatar ninjasort commented on August 22, 2024

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.

blakeembrey avatar blakeembrey commented on August 22, 2024

Added the pageContents option with v1.2.0

from metalsmith-pagination.

ninjasort avatar ninjasort commented on August 22, 2024

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.

blakeembrey avatar blakeembrey commented on August 22, 2024

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.

ninjasort avatar ninjasort commented on August 22, 2024

So if I set pageContents: fs.readFileSync('src/writing/index.html') it works, however it's not utilizing yaml front-matter.

from metalsmith-pagination.

blakeembrey avatar blakeembrey commented on August 22, 2024

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.

ninjasort avatar ninjasort commented on August 22, 2024

Okay, got it working. Thanks.

from metalsmith-pagination.

ninjasort avatar ninjasort commented on August 22, 2024

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.

blakeembrey avatar blakeembrey commented on August 22, 2024

pagination.files is just the raw files. Where are the files coming from?

from metalsmith-pagination.

ninjasort avatar ninjasort commented on August 22, 2024

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.

blakeembrey avatar blakeembrey commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.