Closed kptdobe closed 5 years ago
Just mocking what an API could look like:
const router = require('@adobe/helix-pipeline/router');
function pre(payload) {
return router(payload)
.url('/', 'home')
.url('/*', 'marketing')
.url('/*/docs/*', 'docs')
.content(content => true, 'about');
}
url(pattern, selector)
would include the selector
's response when the pattern
matches the URL.content(predicate, selector)
would include the selector
's response when the predicate
function returns true
for the current content
.
If you have 2 different rendering for some of your website pages, you would either need to code the 2 renderings in your single
html.htl
or need to know how to "dispatch" the incoming request and use ESI to include the proper rendering via a selector (you can find an example of this approach in https://github.com/kptdobe/helix-dispatch)Having one single
html.htl
is not enough even for basic websites where there is always a page that needs to be rendered differently.The idea here is to offer a simple way for the developer to write a
dispatch
function that would determine which HTL renderer to use for a give incoming request and transparently handle the ESI include for him.cc @trieloff