Skip to content
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

Add icon links to header #833

Open
RemDelaporteMathurin opened this issue Apr 19, 2024 · 7 comments
Open

Add icon links to header #833

RemDelaporteMathurin opened this issue Apr 19, 2024 · 7 comments

Comments

@RemDelaporteMathurin
Copy link

RemDelaporteMathurin commented Apr 19, 2024

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",
        },
    ],
}
@danilopeixoto
Copy link

+1

@danilopeixoto
Copy link

danilopeixoto commented Jul 3, 2024

@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",
    ],
}

@RemDelaporteMathurin
Copy link
Author

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

@dylanh724
Copy link

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
Copy link

dylanh724 commented Nov 25, 2024

html_sidebars 

This was great for a while -- but it no longer works (not sure when it broke. The latest 1.1.3 has this issue in both Sphinx 7 and 8):

image
^ The order gets jumbled if I add even 1 icon_links

    "icon_links": [
        {
            "name": "API Docs",
            "url": (
                    "https://foo.com"
            ),
            "icon": "fa-solid fa-book-open",
            "attributes": {"target": "_self"},
        },
        {
            "name": "Discord",
            "url": "https://discord.gg/foo",
            "icon": "fa-brands fa-discord",
            "attributes": {"target": "_blank"},
        },
    ],

@RemDelaporteMathurin
Copy link
Author

Yes we also noticed it in festim-dev/FESTIM#919

@dylanh724
Copy link

Yes we also noticed it in festim-dev/FESTIM#919

It's strange since there hasn't been an official update in a half a year. It seems like someone force pushed a new patch? I don't know, but see related issue above for full workarounds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants