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.
我在localhost上运行我的keystone网站,我正在尝试使用新网站创建一个新的导航链接,但是我收到一条错误,指出链接后面的地址无法找到。
The link is displayed in the navigation bar.
该链接显示在导航栏中。
I created a file in /routes/views/aboutme.js with following code:
我在/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');
};
And a .jade in /templates/views/aboutme.jade file with the code:
和/templates/views/aboutme.jade文件中的.jade代码:
extends ../layouts/default
block content
h1 xyz
p xyzxyzyxzxyzxyzyxzzxyz
p xyzxyzyxzxyzxyzyxzzxyz
p xyzxyzyxzxyzxyzyxzzxyz
Why the Page cannot be found? :/
为什么无法找到页面? :/
1 个解决方案
#1
0
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:
我自己找到了答案。对于具有相同问题的每个人,在/ routes文件夹中都有index.js文件。在这段代码中:
// 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.
“名字”是你新的网站名称。
#1
0
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:
我自己找到了答案。对于具有相同问题的每个人,在/ routes文件夹中都有index.js文件。在这段代码中:
// 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.
“名字”是你新的网站名称。