Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set up a mappings file in a Moovweb project if there are no unique URL paths?

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?

like image 947
michael Avatar asked Dec 17 '25 05:12

michael


1 Answers

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.

like image 146
Liam Avatar answered Dec 20 '25 09:12

Liam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!