-1

I'm looking for a way to create single page model/ standalone single page.

It's like a custom single page for 'About Us', 'Home Page','Our Team',etc.

They are single page with backend options.

Anyone have any idea ?

Binh Nguyen
  • 1
  • 1
  • 1

2 Answers2

0

So you need to create all needed type of files, like route JS file, template file, add info about that file into routes/index.js

example: create file routes/views/aboutUs.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 = "about-us";
  locals.title = "About our company";

  // Render the view
  view.render("aboutUs");
};

create template file templates/aboutUs.pug :

block content
  p Our company is super cool. We based it here long time ago

Put all your static content into template with correct syntax and css

Finally make addition to routes/index.js file:

app.get("/aboutUs", routes.views.aboutUs);

if you need to control user access to page also add such string

app.all("/aboutUs*", middleware.requireUser);

And dont forget to restart the app to see changes

ByteMaster
  • 172
  • 6
0

That's clearly not what OP is asking for. They're asking if there is a way to create a single ADMIN UI editable page for Home, About Us, and so on. My answer is that I don't believe that is possible with KeystoneJS. Which is annoying, because I have clients that want that and Keystone would be perfect otherwise. Seems the only way to do it is create a list, auto create a record if one doesn't exist, and set "nocreat", and "novelette" on the list.