mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-05 00:29:48 +03:00
Hide sidebar blocks. #1055
Open
opened 2026-02-04 23:36:12 +03:00 by OVERLORD
·
33 comments
No Branch/Tag Specified
development
l10n_development
further_theme_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#1055
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @andersonbrantes on GitHub (Feb 20, 2019).
Hello, you are doing a great job with this tool.
Is there a configuration to hide the “recent activity”, “recently updated pages” and “my recently viewed” sidebar blocks?
@ssddanbrown commented on GitHub (Feb 20, 2019):
Hi @andersonbrantes,
Hiding such items is not supported via UI options or anything like that.
If you are handy with CSS it's possible to hide these with CSS rules, placed in the
Custom HTML head contentsetting.If you can confirm the view you're looking at (Do you have a custom homepage set?) I could help with those rules.
@andersonbrantes commented on GitHub (Feb 21, 2019):
Ok @ssddanbrown , I will try to do it with CSS...
I didn't know the custom homepage feature, that's a great idea. I am using BookStack for a Wiki that has private and public documents. The main idea is only users with private permissions could see these sidebar blocks(recent activity, recently updated pages, my recently viewed). Do you think it is possible with the custom pages?
@unknowndomain commented on GitHub (Mar 9, 2019):
@andersonbrantes something like this is what I use:
<style>#sidebar { display: none; } [expand-toggle] { visibility: hidden; }</style>I put this in the page content for our homepage rather than in the custom HTML header where you'd only want:
<style>#sidebar { display: none; }</style>@andersonbrantes commented on GitHub (Mar 10, 2019):
Hi @unknowndomain... I could use something like that, but, I want this rule only for public pages. This is tricky to do with CSS without a specific identifier(Id or Class) for this. Maybe I can do it with Javascript. But, the best way would be on the server side, I think.
There is a similar issue to what I want to do: #1319
@unknowndomain commented on GitHub (Mar 11, 2019):
I agree, another solution which would be helpful generally is that the body tag have a few classes on it to help you figure out what kind of page you are on, i.e.
<body class="shelf">or<body class="page public">or<body class="page private">That way you could write CSS selectors like
body.privateorbody.page.public.This is how WordPress handles the issue.
@ayyilmaz commented on GitHub (Mar 16, 2020):
I think hiding recent activity block from public is important in terms of security at some cases. Some users who has different roles should see this.
@HAMFEM commented on GitHub (Mar 27, 2020):
I fully agree. Pages hidden to some roles appear in the recently changed area to all roles, and they can access it by just clicking the link.
Hiding the side bar is not a good solution, as it makes the navigation less practical in the book/chapter level.
@haveyougotanypets commented on GitHub (Jul 14, 2020):
On the custom css route it would be helpful if IDs or better still class names set for the entire block section so they can be hidden individually. Currently they seem to be applied somewhat inconsistently.
For example i can set in Custom HTML Head Content:
and it removes the whole block. But if i do:
it removes the block contents but not the header because the id tag has been applied at the sub block of the full recently-updated-pages block content.
If the IDs were set on the top block element for each section that would be helpful fix.
Lastly I would think about using classes rather than IDs as at some point you can guarantee someone is going to want to use the same block twice on a page in a customised theme for whatever reason and if you use IDs it will be invalid html and you've got yourself another support ticket.
Lovely looking wiki so far, looking forward to seeing it improve over time!
@purpletreesoft commented on GitHub (Jul 25, 2020):
Any progress on this? This is an important feature IMHO. Right sidebar, history, and if possible top-right header content should be hidden from public.
@SloCompTech commented on GitHub (Jan 12, 2021):
Hi, I'm looking forward to see this feature. I'm looking for a way to hide recent activity, especially usernames for guest viewers. Maybe this could be simply implemented to display Someone instead of real username when guest loads the page ?
@kulpin74 commented on GitHub (Feb 5, 2021):
It's very important feature. In our case we send guest links on specified documents, but all guests can see all documents in Recent activity. Maybe this can be solved through User rights?
@SloCompTech commented on GitHub (Feb 5, 2021):
Yes, possible solution would be, to replace username with Someone and disable link to user based on user role or permission.
@ssddanbrown commented on GitHub (Feb 5, 2021):
Yes, Users (Including guests) should only be able to see the activity for items they have access to. By default the guest user can view everything but this is configurable by alterting their role.
@kulpin74 commented on GitHub (Feb 7, 2021):
If this could be the role "List chapter, books, shelf" it would be great. We could send a link for book/chapter but if we dont't give that role - guests will not be able to list anothers books/chapters. This role can affect showing recent activity too. And of course Guests mustn't be able to view User name or another private information.
@sarah-arrrgh commented on GitHub (Nov 17, 2021):
I've worked around this for now by hiding the sidebar things we don't need in <style> tags in the HTML head content. The way I've done it means all the sidebar headings aren't visible, but it works ok for what we need it for. Not totally secure as folks can just open developer tools and disable "display: none" to see the content, but means general punters won't see unnecessary clutter.
@ssddanbrown commented on GitHub (Nov 17, 2021):
Just want to advise, we do have the visual theme system that can be utilised if you need to do something more extensive outside of setting styles, without altering core app files:
https://github.com/BookStackApp/BookStack/blob/master/dev/docs/visual-theme-system.md
Would allow you to override any view file we use and completely remove those parts if desired.
@satanahell commented on GitHub (Mar 31, 2022):
Hello everyone, this how my wife hide the right panel for guests users only.
She's using the custom HTML head content in Settings with this code :
It's just hidden i can see it appear and vanish in a second, not quite secure IMO but still better than nothing.
She may will work (or not i don't know) on a custom CSS style using the features mentioned above to hide both panels for guests users.
Have a nice day.
@ssddanbrown commented on GitHub (Mar 31, 2022):
@satanahell Slightly optimized/earlier-loading version of that if desired:
Note, if you're hiding the right sidebar with a primary aim to hide export options, these can instead be controlled via role permissions (As most right sidebar actions can at some level.)
@satanahell commented on GitHub (Mar 31, 2022):
@ssddanbrown thanks for your optimized reply, my wife told me that she didn't have your skill level !
I start using this "tricks" in order to expand the main page frame even if i had to hide the left panel too. I still want to display a large google slide into an e-frame on my bookstack instance. Ultimately i find out an acceptable way to achieve that whitout tweaking my bookstack. But i'm still pushing my wife to get a special custom CSS template for this purpose !! 👍
Enjoy your day,
@TritonB7 commented on GitHub (May 2, 2022):
How would I go about hiding all occurrences of the .tag-item class using this? Instead of just the first occurrence.
@tacerus commented on GitHub (Sep 24, 2022):
Thanks for the JavaScript snippets - those work great
, except that the script seems to load quite late, making the sidebar blocks temporarily visible before they are hidden.Edit: I figured this out by mixing some of the suggestions here up a bit and having the element hide unless instead of display if a user is logged in:
This does not quite address the security aspect though - anyone with minor computer knowledge can access the browser console and change the
visibilityvalue themselves, gaining easy access to the "hidden" data.@foxfabi commented on GitHub (Feb 17, 2023):
It would be helpful if I could show/hide these blocks via the settings.
@RMurphy-Impact commented on GitHub (Mar 7, 2023):
This is a kludgy way to implement it, but I was looking for a similar way to hide recent activity and recent books from public users and this is what I've come up with:
As part of the custom theme, I've edited the below files:
common/activity-list.blade.php
home/parts/sidebar.blade.php
Inside of those two, I've wrapped the drafts, recently updated pages, and activity list code blocks in the following if statement:
This should check that a user has any kind of 'creation' permissions before displaying that section, but can be modified to look for whichever permission fits your use best. This works for our uses, but this will also strip the recent activity lists from logged in users that do not have any creation permissions.
@code-kungfu commented on GitHub (Mar 21, 2023):
A variation of the above example, if you only wan to hide recent activity from public viewing, you could use this snippet:
Or completely remove it
@ghost commented on GitHub (Mar 28, 2023):
This worked great. Thanks @tacerus.
@retrokit-max commented on GitHub (Apr 5, 2023):
This works well but just to highlight an edge case: If you have a shelf/book/chapter/page called login then this can stop working and start hiding both panels for logged in users too.
It will continue to work if you include the full link for login to your instance:
const loginShowing = document.querySelector('a[href$="YOUR_PROTOCOL://YOUR_DOMAIN/login"]') == null;@cgregaisc commented on GitHub (May 30, 2023):
Hi -- I appreciate all this problem solving. I would like to exclude/hide ONLY the "recent activity" -- the "Book Navigation" that shows up on the left sidebar is very useful to my users, but I would like them to not see the editing activity. The examples above do not seem to work for me -- the event listeners don't work when all i'm doing is removing recent activity. They are being ignored completely. I also don't want public viewers to be able to see the previous versions of the books/pages.
Not sure how to proceed.
@rooteam-deploy commented on GitHub (Feb 14, 2024):
This seemed to be working for us until the latest update (23.12). Is an updated method required to hide the sidebar?
@hmkim commented on GitHub (Apr 15, 2024):
I'm not familiar with PHP code. Who can provide me with the applied code file? I'd like to see it and apply it myself.
@code-kungfu commented on GitHub (May 26, 2024):
For those of you who are still in search of a solution which doesn't involve JavaScript, this might be helpful to you:
https://github.com/code-kungfu/bookstack-cktheme
@ctrlaltca commented on GitHub (Oct 4, 2024):
It would be really nice if BookStack could integrate the two added permissions from https://github.com/code-kungfu/bookstack-cktheme/ in the main core, to avoid future breakage.
@AGARES2101 commented on GitHub (Dec 21, 2024):
Explanation of the Code:
Side Panels Visibility:
The script hides the left () and right () panels by default.tri-layout-lefttri-layout-right
If the user is authorized (login page is not displayed), the script makes these panels visible.
Recent Activity Panel:
For unauthorized users (those who see the login page), the "Recent Activity" panel with the ID is hidden.recent-activity
Books Link and Icon:
The script looks for the link to books () and hides it if the user is unauthorized. This includes the icon and text associated with the link.a[data-shortcut="books_view"]
When the Script Executes:
The script runs after the DOM content is fully loaded to ensure all elements are accessible for manipulation.
This setup ensures that unauthorized users do not see sensitive or unnecessary content (e.g., links to books or side panels) while allowing authorized users full access.
@alycesuza commented on GitHub (Sep 11, 2025):
[PT] Bom dia, irei compartilhar o que funcionou comigo, vale ressaltar que ele só oculta, as funcionalidades ainda rodam, minha necessidade era de ocultar somente para o publico e deixar tudo se tiver logado como admin:
[EN] Good morning, I will share what worked for me. It is worth noting that it only hides; the functionalities still run. My need was to hide it only from the public and let everything be visible if logged in as admin: