Reference in Servicestack layout

I am using ServciesStack templates in project. Everything is good and working kind of better than razor.

There is one thing I couldn’t figure it out.

Here is file structure in my project

| – _layout.html
| – product.html

Now, resources (javascript,css etc) are referenced in layout. Which works without any issue for index and about page. But breaks for product page.

It is mostly path of resources. If I fix for product it will break for others. I couldn’t figure it out how to solve it.

I guess I am missing something like ~ in template which find out path for resources. Or is there any other way to do it.

Let me know if any further details are required.

PS: Template is awesome. :wink:

Are you using absolute paths? i.e. starting with a / like /js/lib.js

Yes… <script src="js/vender/jquery-3.2.1.min.js"></script> :unamused:

Absolute paths needs to start with /, i.e:

<script src="/js/vender/jquery-3.2.1.min.js"></script>

That thing worked… Thanks man… You are life saver… I was banging my head for that thing since ages…

1 Like