Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make luya\cms\Menu throw 404 instead of adding _currentAppendix #51

Closed
pivans opened this issue Mar 21, 2018 · 12 comments
Closed

Make luya\cms\Menu throw 404 instead of adding _currentAppendix #51

pivans opened this issue Mar 21, 2018 · 12 comments

Comments

@pivans
Copy link

pivans commented Mar 21, 2018

On a request like "/demo-content/disjo" I suppose to get 404, instead of "demo-content" page.
https://demo.luya.io/en/demo-content/disjo
How can I configure this?

@nadar
Copy link
Member

nadar commented Mar 21, 2018

Hi @pivans thanks for the report, seems to be a bug. Of course it should throw a 404.

@nadar nadar self-assigned this Mar 21, 2018
@nadar nadar added the bug label Mar 21, 2018
@nadar
Copy link
Member

nadar commented Mar 26, 2018

I just did a little research on this issue. The "problem" is that you may have a module on this page, which can have urls. So i could make an option to configure "strict parsing".

For example this page has a module: https://demo.luya.io/en/article A click on the article detail allows you to stay on the same page: https://demo.luya.io/en/articles/2/its-just-a-module - therefore all "sub paths" are like wildcard which are allowed.

@nadar
Copy link
Member

nadar commented Oct 16, 2018

Where should this option appear? Its a config in cms module? For example:

'cms' => [
    'class' => 'luya\cms\frontend\Module',
    'strictUrlParsing' => true,
]

@Robot72
Copy link

Robot72 commented Oct 28, 2018

Where should this option appear? Its a config in cms module? For example:

'cms' => [
    'class' => 'luya\cms\frontend\Module',
    'strictUrlParsing' => true,
]

Yes, that would be nice.

@nadar
Copy link
Member

nadar commented Oct 29, 2018

I was just thinking about this again, maybe its bad to configure this in configs, maybe a block should have an flag which can be triggered if NOT strict url parsing is required, for example the module block would implement:

public function requireUrlWildcard()
{
   return true;
}

(all other block which does not need this kind of wildcard urls would return false)

If this is the case (return true), the strict url parsing is automatically disabled for this page.

@Robot72
Copy link

Robot72 commented Oct 29, 2018

requireUrlWildcard

That is, using the requireUrlWildcard method it will be possible to override more flexibly: not only for the luya\cms\frontend\Module, but also for other modules? Do I understand correctly?

@nadar
Copy link
Member

nadar commented Oct 29, 2018

I was more thinking about blocks. Because the module block is the only situation where "url wildcard" behavior is required.

@Robot72
Copy link

Robot72 commented Oct 30, 2018

@nadar do you talk about the cms block ? Or do you talk about a module class (http://i.prntscr.com/ViSlIWLyTUmkebHvbl9ntg.png) ?

@nadar
Copy link
Member

nadar commented Oct 30, 2018

Yes CMS Blocks. Because CMS Blocks are the only situation which need url wildcards but only when the luya cms module block integrates modules.https://github.com/luyadev/luya-module-cms/blob/master/src/frontend/blocks/ModuleBlock.php

@Robot72
Copy link

Robot72 commented Nov 1, 2018

I think it will be good. I would like to try this solution.

@nadar
Copy link
Member

nadar commented Nov 27, 2018

This is also a problem for cms redirects - in order to make a redirect from an existing subpage node this is not possible. example:

/de/foobar <= this page exists
/de/foobar/john-doe <= this page does not exists

now its not possible to make a redirect trough redirects table from de/foobar/john-doe as the cms says: if have found an item - instead of a 404 - which will then activate the cms redirect table.

@nadar nadar added this to the 2.0 milestone Feb 27, 2019
nadar added a commit that referenced this issue Feb 27, 2019
@nadar
Copy link
Member

nadar commented Feb 27, 2019

URL Wildcard paths are now only valid if the parent page is a module or strict parsing is disabled.

Therfore this is a breaking change. When a page contains the module block (not a page which is a module) and the module block can create and follow urls the strict parsing option must disabled in the nav item setting panel.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants