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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With