LIbaries not loading sub pages

Hi, I have created subpages which are using the default template. All libraries I have linked in my header and footer are not loading on the sub pages and are presenting me with a 404 error. I guess this is because I have added a folder called libs or just placed in my root folder where they are being referenced like (shown bellow). Where is the correct place to store all libraries and how do I reference them?

<link rel="stylesheet" href="style.css">
<script src='./libs/bootstrap.min.js'></script>

Doesn’t really matter where you store them, but you make your life easier when you use Kirby css() and js() helpers.

Okay, well in this case why are they not loading on my subpage… The template has loaded correctly its just the link and script tags which are not working as the file cannot be found. The parent folder works fine. My file structure for the content is like this. As a secondary question is there a way to add another template instead of the default to these pages?

2_projects > projects.txt, project-a > project.txt

Where exactly are your assets located? If you stick with your way of doing it, you have to use absolute links rather then relative to the page.

I.e.

<link rel="stylesheet" href="/style.css">

Yes, you can use different templates for subpages, you define them in a pages section in your blueprints using the templates option.

I have just realised that it is trying to find the files in the parent folder rather then the root:
GET http://localhost:8080/kirby-blank/projects/libs/bootstrap.min.js net::ERR_ABORTED 404 (Not Found)

Yes, that happens when you use relative links.

The Kirby way of integrating styles and script files is via the helpers…

So instead of the way I have referenced them, I need to use php like this: <?= css('style.css') ?>

Exactly, if your file is located in the project’s root folder, that is (I would put it into an assets folder or whatever, because I don’t like things lying around in the project root.

okay perfect thanks for the help, and how would I use this same technique with my js files?

In the same way, only using the js() helper.-

perfect thank you!

@texnixe sorry me again, and how about for the favicon?

There is no helper for the favicon, you usually use a whole set, anyway…

okay no worries thanks.

<link rel="shortcut icon" href="<?php echo url('assets/images/favicon.png') ?>">

You can, however, use the url() helper with the path to the asset.

okay, thank you so much for your help.