Page 1 of 1

why is record.twig important in bolt CMS ?

Posted: Fri Jan 01, 2016 10:33 am
by gautamz07
I was just going through this tutorial HERE http://www.sitepoint.com/using-boltcms- ... s-website/ , if you scroll past half the page you'll find the following section:

Retrieving Content From Database Records

The author says the following:
By default, Bolt looks for a record.twig template file to output the “record”, or the contenttype entry. If we preview that testimonial we just created, we’ll get an error thrown at us telling us that Bolt tried to use record.twig, and it doesn’t exist. Let’s create that and throw in some dummy content:
I am not quite understanding the above explanation, why is record.twig important and why will an error be throw ??

can somebody explain ? :cry:

Thank you.

Re: why is record.twig important in bolt CMS ?

Posted: Fri Jan 01, 2016 2:34 pm
by Celauran
record.twig itself isn't technically important. In your content type definitions (contenttypes.yml) you can specify your record and listing templates. Twig is throwing an exception because you're trying to render as a view a file that doesn't exist. Bolt defaults to listing.twig and record.twig in your theme's directory, but you can customize it as needed.

Re: why is record.twig important in bolt CMS ?

Posted: Mon Jan 04, 2016 3:27 am
by gautamz07
Thanks celauran.

Re: why is record.twig important in bolt CMS ?

Posted: Tue Jan 05, 2016 3:51 am
by gautamz07
was just reading the doc's here https://docs.bolt.cm/templates-routes

so suppose i have a content type of testimonials

so now when i navigate to http://localhost:8080/boltCMS/testimonials ,

bolt will look for record.twig ? (ofcourse this con be changed in the contenttype.yml file) , but is this why record.twig is important ? i am just asking , so i am clear on this point.

Re: why is record.twig important in bolt CMS ?

Posted: Tue Jan 05, 2016 6:53 am
by Celauran
record.twig is the default template for individual records of any content type.
gautamz07 wrote:so now when i navigate to http://localhost:8080/boltCMS/testimonials ,

bolt will look for record.twig ?
No. /testimonial/1, for example, would load record.twig by default, but /testimonials (ie. the index page) would load listing.twig by default.

Re: why is record.twig important in bolt CMS ?

Posted: Tue Jan 05, 2016 10:18 am
by gautamz07
Ohh yes right , i confused the two ! TY.