简体   繁体   中英

Keystone Error 404 “No Page could by found at this address (404)”

I'm running my keystone Website on localhost and I'm trying to create a new navigation link with a new site but I get an Error that the address behind the Link cannot be found.

The link is displayed in the navigation bar.

I created a file in /routes/views/aboutme.js with following code:

    var keystone = require('keystone');

exports = module.exports = function (req, res) {

    var view = new keystone.View(req, res);
    var locals = res.locals;

    // locals.section is used to set the currently selected
    // item in the header navigation.
    locals.section = 'aboutme';

    // Render the view
    view.render('aboutme');
};

And a .jade in /templates/views/aboutme.jade file with the code:

    extends ../layouts/default

block content
        h1 xyz
        p xyzxyzyxzxyzxyzyxzzxyz
        p xyzxyzyxzxyzxyzyxzzxyz
        p xyzxyzyxzxyzxyzyxzzxyz

Why the Page cannot be found? :/

I found the answer on my own. For everyone, who has the same problem, in the /routes folder there is the index.js file. In this code at the point:

    // Setup Route Bindings
exports = module.exports = function (app) {

}

Between the curly braces you have to write the following code:

app.get('/name', routes.views.name);

"Name" is your new sitename.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM