-
Notifications
You must be signed in to change notification settings - Fork 200
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 for header customization #182
Comments
Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗 |
Yes, please. If a header + w/ adaptable CSS, I'd adopt this in a heartbeat for several projects. |
Sounds reasonable 😄 |
I just found that part of the documentation - for me, that feature (loading additional CSS and JS) should be enough, although it's sometimes helpful to insert a
The biggest thing would be to add HTML for a header / masthead, similar to the
|
@chrisjsewell it is very possible that i've forgotten about some of the docs associated with customization of the book! yes https://jupyterbook.org/advanced/sphinx.html?highlight=css#custom-css-or-javascript the approach above would work for CSS and javascript... so i'm just back to wanting a header option!! sounds like @ghutchis is also in a similar situation! :) thank you for the positive feedback. branding is so important to us. |
Is there anything I can do to help on this? I have a case that I'd like to deploy soon and would be willing to write some code if I can get some pointers. |
IIRC, you can "just" add
All the HTML for the top bar is in: https://github.com/executablebooks/sphinx-book-theme/blob/master/sphinx_book_theme/topbar.html I think we could get away by merely adding a few "strategically placed" Jinja2 blocks in topbar.html, and that can serve as an extension point for someone that wants to customize it. In case, you wanna fiddle around with the styling... Most of the relevant SCSS is here: https://github.com/executablebooks/sphinx-book-theme/blob/master/sphinx_book_theme/scss/sphinx-book-theme.scss#L570. Be warned: there's a lot of... uhm... not-so-straightforward-to-understand things happening with the layouting of the top bar. :) |
Yep - my guess is that the trickiest part of this will be making sure that the CSS behaves expectedly (because I believe right now we're hard-coding some rules that expect elements to be at the top of the viewport). Would love to see improvements to the CSS that do this more reasonably 👍 |
CSS may be beyond my ability, but I'll take a stab with some strategic Jinja2 and report back tomorrow. |
I would also like to be able to add a custom header and/or footer to the pages generated by JupyterBook. Has anyone figured out a good way to do this, and would you be able to write up the steps? Thank you! |
I ended up adapting the pydata-sphinx theme. |
@ghutchis Would you be able to provide a brief step-by-step? |
+1 to this, would really like to be able to use a custom header |
@ghutchis i'd love to see your approach to doing this. @choldgraf had mentioned making a new theme that suits our needs but i'm not sure how that would get implemented when using jupyter book to build the book. |
The most straightforward way to play around with other themes with Jupyter Book is to use the custom Sphinx configuration as documented here: https://jupyterbook.org/advanced/sphinx.html#manual-sphinx-configuration Basically you'd use something like:
This might be a bit unpredictable, but should work! |
I added some documentation about this here: jupyter-book/jupyter-book#1369 |
Sorry, I've been a bit busy - I edited the sphinx configuration as indicated by @choldgraf At the moment, I don't have the execute 🚀 , download, etc. button / menus. but I found it to be the easiest way to add a header. I found it was pretty easy to hack the |
We're now supporting header customization via the pydata sphinx theme, now documented in #677 ! |
Thanks to everyone who worked on this! |
Can this issue be re-opened?
|
- fixes #63 - fixes #12 - work-around for executablebooks/sphinx-book-theme#182
This related to a discussion here
Is your feature request related to a problem? Please describe.
I'd love to use jupyter book for my textbooks. i have 3 currently on our learning portal. the problem is that because we have multiple books and a portal that is SEO optimized, we want to maintain visual branding of all of our content. This means that ideally we'd like to have the ability to add a header to the book with links back to our main site and to customize the css /colors potentially to better match our existing theme. The site currently is being redesigned btw.
As i'm considering this a footer element would be nice to have too - at CU we have to acknowedge certain things in the footer.
Describe the solution you'd like
I'd like a simple way to adding a header with HTML to all book html pages.
This will likely mean we also need to be able to add stuff to the header (above the
<body>
tag in the<head>
section - which might include css and also js.Describe alternatives you've considered
i've considered creating our own theme but that seems like a lot of work to add a header and css to a page! i'd also have to learn a lot of new things to customize sphinx.
Additional context
have a look at our website and you will see on the home page links to three textbooks. in the site they retain the site skin. they are not separate websites.
thank you for considering this!
The text was updated successfully, but these errors were encountered: