我在localhost上运行我的keystone网站,我试图用一个新网站创建一个新的导航链接,但我得到一个错误,链接后面的地址找不到。
该链接将显示在导航栏中。
我在/routes/views/aboutme.js中创建了一个文件,代码如下:
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');
};以及/ .jade /views/aboutme.jade文件中的模板,其中包含以下代码:
extends ../layouts/default
block content
h1 xyz
p xyzxyzyxzxyzxyzyxzzxyz
p xyzxyzyxzxyzxyzyxzzxyz
p xyzxyzyxzxyzxyzyxzzxyz为什么找不到页面?:/
发布于 2016-05-21 02:58:21
我自己找到了答案。对于每个有相同问题的人来说,/routes文件夹中都有index.js文件。在这段代码中:
// Setup Route Bindings
exports = module.exports = function (app) {
}在大括号之间,您必须编写以下代码:
app.get('/name', routes.views.name);"Name“是您的新站点名称。
https://stackoverflow.com/questions/37333567
复制相似问题