-
Notifications
You must be signed in to change notification settings - Fork 63
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
Allow showing or hiding breadcrumb trail on a page #509
Comments
I have MVC razor views that I also don't want the breadcrumbs to show on. Currently I'm setting the body css class and using css to hide it. This is mainly on the full width/height map pages. I don't see a way that the SimpleContent page editor can know if breadcrumbs are in the layout or not. Perhaps the behaviour of of the current menu filters needs changing, i.e. rather then still showing the breadcrumb and just not including the current page it could hide the breadcrumb instead? But maybe this current behaviour is still desirable too. |
No, there is no way that the simplecontent system can 'know' whether its contents are being rendered into an outer Theme _layout that does or does not support breadcrumbs... and the breadcrumb rendering component is of course from a different CS library altogether. It is presumably simple enough to add a boolean HideBreadcrumbs property to the simplecontent page viewmodel, and make that UI-editable. The architectural problem then comes when rendering the contents of that into the outer Theme _Layout, which will have no explicit access to that property - because the overall _Layout does not formally 'know' the type of the ViewModel... for all it knows SimpleContent might not be installed at all... the job of the _Layout is to wrap around a bunch of underlying (partial) views and it is these that know formally about their required ViewModel types. And again the breadcrumb component is from a different CS library altogether, which knows nothing of SimpleContent. Tactics to get around that latter point therefore are either: Perhaps, better than that, the reflection work could be pushed down to the breadcrumbs rendering component, something like |
oops - closed by accident :/ |
Verified that a conditional navRenderer like that could work... although I think it violates the conceptual separation of the various cs components - cs.Navigation would be rendering conditionally based upon a property that is declared in SimpleContent, even though these components are supposedly independent/autonomous - which doesn't feel right. Maybe keep the 'glue' back out in the _Layout. This would also require a migration to add new 'HideBreadcrumbs' field to cs_Page, I guess. |
See https://www.cloudscribe.com/forum/thread/how-can-i-have-breadcrumbs-on-some-page-and-not-others
Needs a bit of thought about how best to implement this. We wouldn't want to show a page setting that appears to switch on a breadcrumb trail if it's not present in the theme layout. Can SimpleContent be aware as to whether the theme does or does not include the breadcrumb component?
This is included by default in our bootstrap 4 sample themes as follows:
@await Component.InvokeAsync("Navigation", new { viewName = "Bootstrap4Breadcrumbs", filterName = NamedNavigationFilters.Breadcrumbs, startingNodeKey = "" })
But we could have a page setting that hides the breadcrumb - that would not be as confusing, as an editor would not use it if no breadcrumbs are displaying on the site. Ideally the setting would only appear if breadcrumbs are included in the layout - see previous question!
The text was updated successfully, but these errors were encountered: