A SilverStripe theme based on Bootstrap front end framework
A SilverStripe theme based on the
Bootstrap front-end framework.
It should work out of the box on basic sites, so you can drop it into
themes folder, enable it (either programmatically by using
SSViewer::set_theme('silverstrap') or by switching it in the CMS) and
check how your new site look.
The master-1.0 branch is in maintenance mode and it is based on the deprecated (and no longer officially supported) Bootstrap version 2. The master and dev branches, released as silverstrap-2.x.x, are based on Bootstrap 3.
- Should work out of the box.
- No dependency on SASS or Ruby. This is a plain SilverStripe theme:
just unpack the tarball under
themes/and enable it.
- Out of the box support for dynamically generated tables of contents. If you install the silverstripe-autotoc module, silverstrap will generate on the fly the table of contents of the current page (if possible) and it will present it in a .navlist on the right side. Your site will gain table of contents for free.
- Proper support for pages nested at arbitrary levels.
- Quite extensible and customizable. This can be done by overriding the default implementation instead of editing it: check the following section for further details.
Let's say you want to use a custom Bootstrap CSS, such as the ones
provided by Bootswatch. You can download and
store it over the default CSS found in
This works but it will overwrite the default CSS provided by
silverstrap... and this is bad. You loose the possibility to update
silverstrap with a
Instead, you can use the SilverStripe template trick used by silverstripe-treeish to override the templates without touching a byte of the original silverstrap folder:
- put silverstrap under
- create a
silverstrap_Pagedirectory at the same directory level: any page of type
Page(hence the whole site) will look for templates in this directory first;
- copy the new bootstrap CSS in some place accessible by the web
server, e.g. under
themes/silverstrap_Page/templates/Includes/Bootstrap.ssand put the following code in it:
This trick can be used to override anything, such as to enhance the default page template, to set the favicon, to add or remove a feature or to put a watermark on every page. The templates in silverstrap are quite fragmented to make it easier to change only a single aspect.
The default implementation provides support for custom nested levels
in .navbar but does not provide a way to access the parent pages, as
commonly provided by vanilla SilverStripe. In other words, if you have
yoursite/contacts/ you can access them but there is no
easy way to access
yoursite/contacts/ (apart from directly write the
To alleviate the problems a Sitemap of the first two levels is put by default before the footer. This does not resolve the problem for further levels though.
To be able to access the parent pages directly from the .navbar you
NavbarSubmenu.ss and add a fixed item at the beginning
<ul> list, right before looping on
NavbarSubmenuAccessible.ss file does exactly that, so you should use
it instead of the original template. By leveraging the override trick
explained in the previous section, you can accomplish this by creating
themes/silverstrap_Page/templates/Includes/NavbarItem.ss under your
website directory with the following content:
<% if $Children %><% if $Parent %> <% include NavbarSubmenuAccessible %><% else %> <% include NavbarMenu %><% end_if %> <% else %> <% include NavbarLink %> <% end_if %>
For bug reports or feature requests, please use the dedicated development tracker.