Roots Discourse

Display_sidebar filter vs @section sidebar

I’m using Sage 10.0.0-dev, latest available in the repo today.

I came across this page:
https://roots.io/docs/sage/9.x/sidebar/#displaying-the-sidebar

After adding the filter to /app/filters.php, the localhost page reloaded in my browser, I looked at a blog post and the 404 page, sidebar is still missing.

I looked for documentation to see what I’m missing but didn’t find much that was helpful. Does the filter need to be called somewhere? In a controller maybe?

So, as I just hinted, I then went to /views/index.blade.php, I see how the sidebar is added using different code.

@section('sidebar')
  @include('partials.sidebar')
@endsection

When I applied this to either single.blade.php or 404.blade.php, the sidebar appears.

Am I missing some documentation to understand how to apply the sidebar filter example? Considering I could be interested in adding a sidebar to more than just posts and 404 pages, a filter makes more sense to have everything in one place. I appreciate your answers!

The sidebar filter is only relevant to Sage 9 (see the URL of the link you posted). Sage 10 does not use this filter and it will have no effect. In Sage 10 (as you’ve deduced) you show the sidebar by making use of the @section directive. Or however you want: The examples in the repo are only examples to illustrate how Blade works.

I appreciate the confirmation. I knew the link I posted above is to Sage 9 but I’m not able to find much documentation for the changes to Sage 10 outside of commit messages so it was time consuming to learn. Hopefully this filter will be removed from Sage 10 if it’s not used or needed any longer so others won’t be confused. Thanks again!

Hopefully this filter will be removed from Sage 10

I don’t believe the filter exists in Sage 10 currently.

I’m not able to find much documentation for the changes to Sage 10

There isn’t published documentation for Sage 10 because it’s still under development, and so is the documentation. You can see the Sage 10 docs in their current state here: https://github.com/roots/docs/pull/249

2 Likes

I don’t believe the filter exists in Sage 10 currently.

Oh right, I did that myself because of the original link above, haha, sorry

You can see the Sage 10 docs in their current state

Thank you!