sphinx-book-theme icon indicating copy to clipboard operation
sphinx-book-theme copied to clipboard

Add icon links to header

Open RemDelaporteMathurin opened this issue 10 months ago • 4 comments

Hi all,

Thanks for this very good theme!

I would like to add a link to our discourse page next to the repository, download, full screen and dark mode buttons.

Unfortunately, I've only been able to add it to the sidebar following the documentation.

Is there anyway to move this icon link there?

Thanks!

image

My conf.py html_theme_options

html_theme_options = {
    "repository_url": "https://github.com/festim-dev/FESTIM",
    "use_repository_button": True,
    "use_edit_page_button": True,
    "repository_branch": "main",
    "path_to_docs": "./docs/source",
    "icon_links": [
        {
            "name": "Community Forum",
            "url": "https://festim.discourse.group/",
            "icon": "fa-brands fa-discourse",
        },
    ],
}

RemDelaporteMathurin avatar Apr 19 '24 18:04 RemDelaporteMathurin

+1

danilopeixoto avatar Jul 03 '24 05:07 danilopeixoto

@RemDelaporteMathurin We can do this ourselves by adding to the theme configuration the following:

html_theme = "sphinx_book_theme"
html_theme_options = {
    'icon_links': [
        {
            'name': 'PyPI',
            'url': 'https://pypi.org/project/jupyterhub-ai-gateway',
            'icon': 'fab fa-python',
        },
    ],
    "article_header_end": [
        "navbar-icon-links",
        "article-header-buttons",
    ],
}

html_sidebars = {
    "**": [
        "navbar-logo",
        "search-button-field",
        "sbt-sidebar-nav",
    ],
}

danilopeixoto avatar Jul 03 '24 05:07 danilopeixoto

This works! Thank you very much @danilopeixoto !! 🚀

RemDelaporteMathurin avatar Jul 03 '24 08:07 RemDelaporteMathurin

Thanks @danilopeixoto ! It did align there and set the initial color, but hovering will be very different than the gitlab icon:

image

image

I'm having trouble finding the CSS for it; any tips?

dylanh724 avatar Aug 15 '24 03:08 dylanh724