Table of Contents

How to create your own theme?

About

This page shows you how to create your own theme.

You can then apply advanced design and logic to your whole website application.

Theme introduction

Combostrap uses a theme system where:

Steps

Where is the default theme ?

The Combostrap default theme is located in this directory

dokuwiki_home/lib/plugins/combo/resources/theme/default

If you discover this theme, you will this layout directory:

Combostrap Default Theme File Explorer

What are handlebar templates (hbs)?

Handlebar templates are files that are written in the following two languages:

They get an array of data called a model and replace their value at runtime.

To simplify, the model is:

If you want to get the whole model definition, contact us.

For instance, the following handlebars expression would be replaced with the page tile

{{ title }}

What are template definition files (yml)?

The template definition files contain properties that apply to the template.

For instance, if you want to use slots in your template, you need to define them.

The median template for instance contains 4 slot elements.

slots:
    - 'page-header'
    - 'page-footer'
    - 'main-header'
    - 'main-footer'

What are partials?

Handelbar partial are handlebars syntax that can be included and therefore reused in templates.

For instance, the below handlebars syntax will include the partial page-footer-partial.hbs that contains the footer of each template.

{{>page-footer-partial}}

What are components stylesheet?

A component stylesheet is a tiny CSS stylesheet that is applied when a component is used on your page.

It will overwrite the default styling of your bootstrap stylesheet.

Creation of your theme directory

Combostrap looks at themes in the directory combo/theme located in the data directory

For a standard dokuwiki installation, the directory is:

dokuwiki_home/data/combo/theme

If you name your theme, mytheme, you should then create the following directories

dokuwiki_home/data/combo/theme/mytheme
dokuwiki_home/data/combo/theme/mytheme/components/css
dokuwiki_home/data/combo/theme/mytheme/components/html
dokuwiki_home/data/combo/theme/mytheme/pages/templates
dokuwiki_home/data/combo/theme/mytheme/pages/partials

Selecting your theme

Now that you have created your theme directory, you can select it.

Theme Configuration Value Choice

Creation of your first template

dokuwiki_home/data/combo/theme/mytheme/pages/templates/custom-median.hbs
dokuwiki_home/data/combo/theme/mytheme/pages/templates/custom-median.yml
<header id="main-header">
  <h1>Custom title: {{ title }}</h1>
</header>

Choose your new template for your page

Template Selection Meta Manager

Theme Creation Custom Title Result

How to apply a template for a whole namespace?

The default template follows the following pattern:

If you want to apply the same template for the namespace :howto, you need to create the following templates:

Note that these templates will be applied by default on every namespace that has this name. For instance, they will also be applied to the namespace :docs:howto.

If you want to be more precise, you need to add all namespace name parts in the name of the template. In our case, you need to create the following templates:

Next

From there, you can create any theme that suits your needs.