laravel / folio

Page based routing for Laravel.
MIT License
568 stars 46 forks source link

Check if foo.blade.php file_exists for static route before taking /[param] for account? #137

Closed pronode closed 6 months ago

pronode commented 6 months ago

If we have such dir structure:

/pages
   about.blade.php
   /[Post-slug]
       index.blade.php

navigating to /about should - in my opinion - load about.blade.php instead of looking for a Post with slug = 'about'.

It works correctly if we make /about dir and put index.blade.php inside but wouldn't the above solution be more convenient?

pronode commented 6 months ago

I searched through the closed issues and I've found similar ones with [param].blade.php file inside the same directory as foo.blade.php so the navigation to /foo fails. Please consider changing the convention because it's quite annoying to have 6 different index.blade.php tabs opened in the editor :) And thanks for all the work of course!

driesvints commented 6 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

pronode commented 6 months ago

This is clearly not a question for support channel. This is related to the mechanics of the library. The special case should take priority over the general case. If creating /foo/index.blade.php works then /foo.blade.php should work as well...

inmanturbo commented 5 months ago

@pronode the file checker/loader pipeline works a lot like middleware. You can see an example how to easily customize it for your app it in this (merged) pr:

https://github.com/laravel/folio/pull/113#issue-1924711034

mrcsmcln commented 6 days ago

This really feels like a bug to me. The only workaround I've been able to find is by replacing this:

pages/
    about.blade.php
    [Post]/
         index.blade.php

with this:

pages/
    about/
        index.blade.php
    [Post]/
        index.blade.php

With a lot of top-level routes, that become messy pretty quickly and involves a ton of index.blade.php files.

Any chance we could reconsider opening this issue?