Include a partial in your theme:

Partials allow you to modularize your code into different files. To include a partial, insert this line of code into your CleanSlate theme:

<r:partial name="my-partials-name" />

Replace my-partials-namewith the name of your partial.

Note: Partial file names  must start with an underscore. For example, the full filename from above would be _my-partials-name.html. This allows us to quickly differentiate between partials and page templates.

See an example of partials in use in default.htmlin the CleanSlate Toolkit or check out r:partial in the Tag Index.

Shared Partials

In CleanSlate, there's a concept of "Shared Partials". Shared partials allow us to share bits of HTML from a different theme. For example, WVU's masthead and footer get served from a shared partial. We don't want to duplicate this HTML for every single site, so we serve it from one shared repo called Code.

Shared partials come in handy for colleges or departments that have things like global navigations or other shared elements that are globally used across each site within the college or department. Shared partials can be used from any repository in CleanSlate. If you would like to request a shared repository, please fill out the site request form and indicate the repository will be a shared repo under "Additional Comments" at the end of the form. If you foresee your college or department needing shared partials, it's a good idea to get this set up early.

How do you use them? Glad you asked:

<r:partial name="my-partials-name" theme="Code" />

The theme="Code" bit refers to the name of the theme as seen in CleanSlate. It's not the name of the repository in Stash.


There's a "views" and a "layouts" folder. Where do I save partials?

Great question! Partials should be saved in the same directory as where they're being called. So, if frontpage.html calls "_my-partial.html", "_my-partial.html" should go in the views folder. If your default.html layout calls a partial, that partial should be saved inside the layouts folder.

Last updated on June 16, 2015.

We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:

  • A brief description of the issue
  • A link to the page where you saw the issue
  • Screenshots that illustrate the problem - How do I take a screenshot?

Kindly email for help or use the form on the request help page.