mrb93
mrb93

Reputation: 47

Bolt CMS - How style pages of same ContentType in different ways?

Newb question.

I have multiple static pages in my website - the homepage, about us, company mission, contact page, etc, under the same ContentType "Pages".

However, I just can't apply a singular page.twig template to all of them, since they're all radically different.

How can I link them all up to different CSS templates?

Upvotes: 0

Views: 139

Answers (1)

jadwigo
jadwigo

Reputation: 339

The preferred way in bolt would be to add a templateselect field. https://docs.bolt.cm/3.2/fields/templateselect in the contenttypes.yml

pages:
    [..]
    fields:
        template:
            type: templateselect
    [..]

With that you can set a different template for each page.

Another way would be to add a body-class to the pages based on a value that is set with the content, you can use that class for the css styling.

Upvotes: 1

Related Questions