3

I want to set up the mappings.ts file in my Moovweb project. The answer on how to set up the mappings file was informative but focused on URL paths.

My site has lots of pages that look the same (so can probably be transformed with the same Tritium file), but there are no common elements to those URLs (e.g. they don't have a nice /product/ in the path of the product pages).

Is there any way I can map pages on my site?

Community
  • 1
  • 1
michael
  • 209
  • 1
  • 7
  • Would you post a few urls that takes to products? One option would be to use query string, which most probably have the same parameter names – fegemo Apr 23 '13 at 17:57

1 Answers1

5

You can import Tritium files based on page elements rather than URLs by checking for an element's existence and importing within that scope. I've seen it done in this sort of format:

$("./div[@id='product_element']") {
  $page_type = "product"
}

...

match($page_type) {
  with(/product/) {
    @import "product.ts"
  }
}

When your URL structure isn't especially consistent, this can be a good way to differentiate between types of pages.

Liam
  • 166
  • 4