Sage 10 Default Primary Sidebar not loading

I have a pretty default sage 10 in the works with WooCommerce called Moiraine . The default primary sidebar resources/views/sections/sidebar.blade.php that comes with Sage 10

@php(dynamic_sidebar('sidebar-primary'))

as well a footer one are left intact in app/setup.php:

...
add_action('widgets_init', function () {
    $config = [
        'before_widget' => '<section class="widget %1$s %2$s">',
        'after_widget' => '</section>',
        'before_title' => '<h3>',
        'after_title' => '</h3>',
    ];

    register_sidebar([
        'name' => __('Primary', 'sage'),
        'id' => 'sidebar-primary',
    ] + $config);

    register_sidebar([
        'name' => __('Footer', 'sage'),
        'id' => 'sidebar-footer',
    ] + $config);
});

When I go to widgets the primary sidebar also shows default widgets for search , latest posts and comments.

But when I load the index.php

@extends('layouts.app')

@section('content')
  @include('partials.page-header')

  @if (! have_posts())
    <x-alert type="warning">
      {!! __('Sorry, no results were found.', 'sage') !!}
    </x-alert>

    {!! get_search_form(false) !!}
  @endif

  @while(have_posts()) @php(the_post())
    @includeFirst(['partials.content-' . get_post_type(), 'partials.content'])
  @endwhile

  {!! get_the_posts_navigation() !!}
@endsection

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

I do not see widgets loaded. What am I missing here stil?

:thinking: By default in Sage 10, the sidebar is included in index.blade.php (equivalent to index.php).
Just guessing here, but theoretically, what if there is another page template is used instead that does not include the sidebar (like home)?

2 Likes