Hi everyone,
I am currently trying to set a route to force the download of a pdf on many different subpages.
Each subpage/project will have its own pdf. In the template I’d like to link to “index/projectname/download”.
How do I set the route for this?
So far I’ve got the following:
c::set('routes', array(
array(
'pattern' => 'index/(:any)/download',
'action' => function() {
page()
->files()
->filterBy('extension', 'pdf')
->first()
->download();
}
)
));
I believe I need to tell kirby to fetch the current page’s pdf, but I have no idea how to.
Thanks!