http://www.perlmonks.org?node_id=11100253


in reply to Mojolicious: Optional placeholder and template name

If you run your site under morbo, the debug output should have some information on why your template is not rendering. The default error page under morbo is also helpful.

When you reference a link in the final html that is rendered, it will be relative to public. So a link like src=/blah.js means search for it in the public directories of the app, by default /public.

Update: Fix link

Second Update: Static files are served in sequential order from the array  $app->static->paths.

Replies are listed 'Best First'.
Re^2: Mojolicious: Optional placeholder and template name
by frazap (Monk) on May 21, 2019 at 10:12 UTC

    Thanks for helping. I should be more specific:

    The template common_js.html.ep (in ./templates) that load the js files is
    <script src="monomapdata.js" type="text/javascript"></script> <script src="monomap.js" type="text/javascript"></script> <script src="utils.js" type="text/javascript"></script>
    This works when I call http:// .... :3000/libmap, but not with :3000/fr/libmap If I change the src values to
    <script src="../monomapdata.js" type="text/javascript"></script> <script src="../monomap.js" type="text/javascript"></script> <script src="../utils.js" type="text/javascript"></script>
    :3000/fr/libmap works. But is it the right way to do this ?

    Thanks

      Did you try
      <script src="/monomapdata.js" type="text/javascript"></script>
      ?
        Yes ... That works too...

        How come ? Why ?