Book Navigation Block Not Appearing

Created on 19 September 2024, 3 months ago

Problem/Motivation

The Book Navigation Block is not appearing on any of the book pages I've created.

I've placed two blocks into the right sidebar with my theme: Book Navigation and Who's Online. The "Who's online" block is displaying as expected, but not the Book navigation block.

Note: in the Block configuration settings, there are no restrictions under 'Roles'

Steps to reproduce

  1. Enable the "2.0.0-alpha-1" contributed Book module, and set the basic configuration for the content type under /admin/structure/book/settings
  2. Create a published top- level book page and add few published child pages.
  3. Place the "Book navigation" block in a visible region, selecting "Show block only on book pages" in the block settings and without further "Visibility" conditions.
  4. Visit any of the book pages and see that the block is not there.

At present, I don't believe this is user error and so I'm submitting this as a Bug report.

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

User interface

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jimmb
  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland maenjuel

    Same issue here, can confirm. There is nothing related to the book menu block in the code, so the block is simply not displayed.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Can you verify any block conditions being set?

    Just tried reproducing following the same steps and block navigation appears just fine.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Did you select Node from URL from the context filter?

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland maenjuel

    In my case, the only condition I set is "Show block only on book pages". I also tried it with a fresh Drupal install (both 11.0.4 & 11.0.5, and book module 2.0.0-alpha2 and 2.0.0-alpha3). Same behavior - simply no book menu appearing.

    I also disabled CSS and JS caching, and flushed the cache under Performance, just to be save.

    If I set "show block on all pages" (page is German, so I'm not sure if that is the exact English term), I indeed see the block on every page (admin pages included), but it will only show the first level of the navigation, which is simply a list of all books. This is also the case when I'm on a book page that has child pages (though this might be the intended behavior).

    Just in case, though I don't think is relevant: tested on Apache 2.4.62 and PHP 8.3.11.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    You need to set the block context

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland maenjuel

    I'm a bit confused as to set what block context. I place the block to the desired region, set to "Show block only on book pages", and expect the block to appear on book pages. Just to test, I also selected all boxes where I can select on which books the block is visible, but the block doesn't appear.

    Does the book module and the navigation block from Drupal 10 behave differently to this contrib module? I set up the block in a D10 installation exactly the same as with D11 and the contrib module, and it works in D10 but not in D11+contrib module.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    In my case, I took the advice to "select Node from URL from the context filter", and that helped a little ... Here are my current settings:

    - At /admin/structure/block, I have 2 blocks in the desired block region: "Who's online" and "Book navigation". For both of these, under 'Visibility' I've set them to only appear on book nodes

    - At /admin/structure/block/manage/dxpr_theme_booknavigation?destination=/admin/structure/block, I have the following settings:

    -- Under 'Book navigation block display', I've selected: Show block only on book pages
    -- Under 'Node', I've selected: Node from URL
    -- Under Visibility > Book, I've checked the boxes for both of the books I've created
    -- For everything else (Response Code, Pages, Response status, Roles, Content type, Vocabulary), I've left things as is. Note: this means for 'Content type', I've checked none of the boxes including "Book page" (assuming the setting 'Show block only on book pages' should take care of it).

    And with these settings, this is what I've getting:

    - When logged in, the "Book navigation" block is showing up now as expected.
    - When viewing the same page as an anonymous user (i.e. logged out), the 'Book navigation' block is not showing up. It should be appearing, though, since I'm not restricting the display of this block by role.

    - When the 'Who's online' block is also active in that block region, then the 'Book navigation' block appears as expected
    - If i remove the 'Who's online' block from that block region (so only the 'Book navigation' block is there), then the 'Book navigation' block disappears. This should be appearing, though, regardless of whether another block is there as well.

    So overall, it does seem that selecting "Node from URL" does help to make this block appear. But there are still some other issues that need addressing. I've included my other settings above in case that helps to narrow down some of this.

    Final note: these notes were made after upgrading the 'Book' module to 2.0.0-alpha3

  • ๐Ÿ‡จ๐Ÿ‡ญSwitzerland maenjuel

    Setting "Node from URL" under "Node" did the trick for me (logged in and anonymous as well), so it was rather the new behaviour of the book module than any technical difficulties in my case.

    Not sure if this is something to add to the documentation, since this configuration step doesn't seem too intuitive to me, but is crucial nevertheless (but that might also just be me :)).

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    I have a couple more updates now, after updating to Book module vsn. 2.0.0-alpha4

    1. I switched the default theme to Olivero, and placed only the 'Book navigation' block into a desired block region. Results:

    a. The 'Book navigation' block is showing up for anonymous users as expected.

    b. If I add another block to that same region, then all the blocks disappear for anonymous users.

    c. The 'Book navigation' block is NOT showing up for logged-in users (when only 1 block is in that region).

    d. Also, for anonymous users, there is a link at the bottom of any book node for 'Add sibling page'. I assume this should not be seen, since anonymous users have no permissions to add content?

    e. Also, when logged in, the 'Book trraversial links' section is not showing up anymore. I'm only seeing "Add child page", "Add sibling page" and "Printer-friendly version" links.

    2. I switched the default theme back to DXPR (what this website is using normally). Results:

    a. The 'Book navigation' block is still NOT showing up for anonymous users.

    b. The 'Book navigation' block is still only appearing for logged-in users if another block is placed in that same region. I've tried with 'Search' and 'Who's online', and having either of those in the same block region makes 'Book navigation' appear.

    c. The 'Book traversial links' is also not appearing for anonymous users anymore. Maybe that has gone away with the newer alpha versions of this module? I hope not, though, since that is a very helpful feature that was core to the old Book module.

    End of report for now - hopefully this is helpful and that these things can be fixed.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Did you test the MR?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    This was confirmed by a co-worker on another book ticket they're working on.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    Hello - I'm still seeing all the same problems and am not seeing a new release to check with .... So how can this be marked as fixed?

    Also, apologies, but I don't know what "MR" stands for. So I'm not sure what to do with that question....

    But overall, there were multiple bugs happening for me and so I'm not sure how this ticket can be closed yet. Especially when I'm not seeing any change on my side.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    MR is the merge request with the changes. This fix isnโ€™t in a tagged release yet

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    Thanks for the clarification on MR - now I know what that means!

    So, being that I'm a low-code site builder, and that my book project is being built on a staging site, I'll probably wait until your fixes are merged into the next tagged release.

    But until then, it's great to know that most likely these issues have been addressed now.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    I hate to reopen this, but I just tested with Book 'Book 2.0.0-alpha-5'. There are definite improvements, but a couple issues are still present.

    Note: I have switched my theme to Olivero on a staging site for these comments. I'm assuming Olivero is a good simple theme to test with (let me know if I should use something else).

    Results of latest testing, after placing the 'Book navigation' block into the 'Sidebar' block region:

    a. The 'Book navigation' block is showing up for anonymous users as expected. --> This is still the case = PASS

    b. If I add another block to that same region, then all the blocks disappear for anonymous users. --> This doesn't happen now - the 2nd block just appears along with the Book navigation block = PASS

    c. The 'Book navigation' block is NOT showing up for logged-in users (when only 1 block is in that region) --> This is showing up now as expected = PASS

    d. Also, for anonymous users, there is a link at the bottom of any book node for 'Add sibling page'. I assume this should not be seen, since anonymous users have no permissions to add content? --> This is still showing up unnecessarily = FAIL

    e. Also, when logged in, the 'Book trraversial links' section is not showing up anymore. I'm only seeing "Add child page", "Add sibling page" and "Printer-friendly version" links. --> This is still the case = FAIL

    Lastly, I'll just make a note that the indentation of each book page list item quickly takes up all the space in the block, creating numerous text breaks and making the text pretty unreadable. I've attached a screenshot of this for reference. I'm guessing this indentation can be solved with CSS, but still overall there seems to be an opportunity at the design level to make this work better.

  • Status changed to Fixed about 1 month ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jimmb

    Just one last note that I'm okay if these things are not resolved. Considering the screenshot in my last comment, if that's how this block is going to display on this website -- given the amount of pages and length of their titles -- then it's basically unusable anyway.

    The only thing here that *is* still needed is the Book Traversal Links' functionality. I will open a new issue for this specifically.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly Cheope

    Not knowig if it helps, but I had to revert back manually to book 2.0.0-alpha3 and place again the navigation block to show it up. It didn't show up anymore with book 2.0.0-alpha4, book 2.0.0-alpha5 or book 2.0.x-dev. All the mentioned versions except alpha3 didn't have the context "Node from URL" option anymore.

Production build 0.71.5 2024