Slakinov
Slakinov

Reputation: 341

Is it possible to make a template with no ContentType to fetch arbitrary data in Bolt CMS?

I'm in the process of building an education site, with Departments, Courses, and Modules (all working out fine so far).

I need to make a custom Timetable page that will fetch all Modules of all Courses and plot them into a weekly calendar.

I've setup a menu entry for /calendar and made a calendar.twig template, but since there is no ContentType called Calendar the template cannot be found.

Making a ContentType for Calendar doesn't really make sense since the Calendar will be fetching and displaying Modules and Courses, for which there are already working templates.

Is there a way to setup a menu option / route to a template with no specific pre-fetched content, allowing me to just pull in everything I need via twig 'setcontent' to build my calendar? Or does this go against the grain of Bolt?

Upvotes: 1

Views: 80

Answers (1)

Slakinov
Slakinov

Reputation: 341

Turns out there is support for exactly this (in Bolt 3.0) just putting the answer here in case it helps anyone else.

I added this to my routing.yml and it now works as expected, allowing me to fetch any content via twig:

templatebinding:
    path: /calendar
    defaults:
        _controller: controller.frontend:template
        template: calendar

Upvotes: 2

Related Questions