Expresse-Paginate Not Routing Correctly

I am trying to use the express-paginate package, that requires the mongoose-paginate package. I have set up the mongoose-paginate in my model file and wrapped the express-paginate around my routes and call it in the views file just as the documentation says, but for some reason when I try to click on the next link, I am taken to an /undefined page. My results also aren't being limited by the 10 records I defined in the middleware. I can't seem to debug the issue. There is mention of calling `var Users = db.model('Users') or something related, but is that necessary?

Error:

Cannot GET /undefined

blogModel.js:

var mongoose    = require('mongoose');
var mongoosePaginate = require('mongoose-paginate');
var Schema      = mongoose.Schema;



var BlogPostSchema  = new Schema({
        title: String,
        author: String,
        content: String,
        date: { type: Date, default: Date.now }
});

BlogPostSchema.plugin( mongoosePaginate );

var Blogpost = mongoose.model("Blogpost", BlogPostSchema);



module.exports = mongoose.model('Blogpost', BlogPostSchema);

routes.js:

var express = require('express');
var router = express.Router();
var blogDB = require('../config/blogDB.js');
var Blogpost = require('./models/blogModel.js');
var paginate = require('express-paginate');

//index
    router.route('/')
    .get(function(req, res) {
    var drinks = [
            {   name: 'Bloody Mary', drunkness: 3 },
            {   name: 'Martini', drunkness: 5 },
            {   name: 'Scotch', drunkness: 10}
        ];

        var tagline = "Lets do this.";

        res.render('pages/index', {
            drinks: drinks,
            tagline: tagline
        });
    });


router.use(paginate.middleware(10, 50));


//blog
    router.route('/blog') 

        // START POST method
        .post(function(req, res) {

            var blogpost = new Blogpost(); // create a new instance of a Blogpost model

            blogpost.title = req.body.title; // set the blog title
            blogpost.author = req.body.author; // set the author name
            blogpost.content = req.body.content; // set the blog content
            blogpost.date = req.body.date; // set the date of the post
                //Save Blog Post
                blogpost.save(function(err) {
                    if (err)
                        res.send(err);

                    res.json({ message: 'Blog created.' });
                });

        }) // END POST method


        // START GET method
        .get(function(req, res, next) {

            Blogpost.paginate({}, req.query.page, req.query.limit, function(err, pageCount, blogpost, itemCount) {

                if (err) return next(err)

                    Blogpost.find(function(err, blogpost) {
                        if (err)
                            res.send(err);

                        blogpost.title = req.body.title; // update the blog title
                        blogpost.author = req.body.author; // set the author name
                        blogpost.content = req.body.content; // update the blog content
                        blogpost.date = req.body.date; // set the date of the post

                        res.format({
                            html: function() {
                                res.render('pages/blog', {
                                    blogpost: blogpost,
                                    pageCount: pageCount,
                                    itemCount: itemCount
                                })
                            },
                            json: function() {

                                res.json({
                                    object: 'blogpost',
                                    has_more: paginate.hasNextPages(req)(pageCount),
                                    data: blogpost
                                })
                            }
                        }); // END res.format(html, json)
                    }) // END Find Blogpost 
            }); // END Blogpost.paginate
        }); // END GET method


    //Route for individual blogs
    router.route('/blog/:blogpost_id')

    // START GET method blog by ID  
    .get(function(req, res) {
        Blogpost.findById(req.params.blogpost_id, function(err, blog) {
            if (err)
                res.send(err);
            res.json(blog);
        });
    }) // END GET method blog by ID

    // START PUT method
    .put(function(req, res) {

        Blogpost.findById(req.params.blogpost_id, function(err, blogpost) {

            if (err)
                res.send(err);


            blogpost.title = req.body.title; // update the blog title
            blogpost.author = req.body.author; // set the author name
            blogpost.content = req.body.content; // update the blog content
            blogpost.date = req.body.date; // set the date of the post

            blogpost.save(function(err) {
                if (err)
                    res.send(err);


                res.json({ message: 'Blog updated.' });
            });

        });

    }) // END PUT method

    // START DELETE method
    .delete(function(req, res) {

        Blogpost.remove({
            _id: req.params.blogpost_id

        }, function(err, bear) {
            if (err)
                res.send(err);

            res.json({ message: 'Successfully deleted' });
        });
    });



//about
    router.get('/about', function(req, res) {
            res.render('pages/about');
    });


module.exports = router;

paginate.ejs:

<div class="grid">
    <div class="col-1-1">
        <div class="paginate">


                <ul>
                <% if (paginate.hasPreiousPages) { %>
                    <li>
                        <a href="<%=paginate.href(true).prev %>">Previous</a>
                    </li>
                <% } %>

                <% if (paginate.hasNextPages) { %>
                    <li>
                        <a href="<%=paginate.href().next %>">Next</a>
                    </li>
                <% } %>
                </ul>


        </div>
    </div>
</div>