Skip to main content
  • Home
  • Tutorials
  • Testing Shared Partials/Super Template with Hammer VM

Testing Shared Partials/Super Template with Hammer VM

Testing shared partials and/or the Super Template with Hammer VM is no different than testing any other CleanSlate theme. To add a shared partial, just add a partial directly to your theme’s templates. To test a Super Template enter the appropriate data in your “slots” in your mock_data.yml file. It looks like this:

page:
  id: 1 # This number must match the ID of the current blog you want to display
  name: "Home"
  slug: "home"
  meta_description: "Hello World"
  title: "This is the best Test page ever!"
  alternate_name: "Some other name"
  depth: 1
  updated_at: today
  created_at: two weeks ago
  published_at: now
  default_page: false
  data:
    slot_1: "hero"
    slot_1_custom: ""
    slot_1_where_to_display: "as_full_width_block"
    slot_1_is_main: "0"
    slot_1_align: "left"
    slot_1_featurettes_style: "default"
    slot_1_featurettes_id: ""
    slot_1_number: 1
    slot_1_loop_by: "sort_order"
    slot_1_loop_labels_match: "all"
    slot_1_loop_order: "asc"
    slot_1_scope: 0
    slot_1_show_hidden: 0
    slot_1_limit: 4

Note, you also have to clone the WVU Design System project into your cleanslate_themes directory separately. This is where Hammer will grab the shared partials from.

The other thing to keep in mind is that, when testing a Super Template, the template uses “slots” to customize templates dynamically. You can’t really associate a given set of components (via slots) with a specific template using Hammer VM. Whatever data you enter for the slots in Page 1 in your custom data is what will display for every template. In other words, you can’t test more than one template at a time if defining your templates via mock data.

If you need to test more than one template at a time, consider swapping out the slots partial with shared partials when testing locally, then swap them back when ready to push your changes.

Another option would be to comment your page key for different templates. You can do this using the # symbol. For example:


  # Page key for the backpage template
  # page:
    # id: 2
    # name: "Backpage"
    # ...more key/value pairs...
    # data:
      # slot_1: "my-partial-name"
      # slot_1_custom: ""
      # slot_1_where_to_display: "as_full_width_block"
      # ....more key/value pairs...