Adding images to the sidebar.

92 views
Skip to first unread message

Andrew Back

unread,
Apr 10, 2021, 4:20:38 PM4/10/21
to sphinx-users
I'm using RTD theme and would like to include additional images in the sidebar, similar to how readthedocs.io has shown adverts in their sidebar. In may case, two images of the same size as the site logo and aligned to the bottom of the sidebar.

First hurdle was that I can't see how to have these additional images copied from the images/ directory at build time, along with the site logo and favicon. Then I wasn't sure what the best way is to modify the sidebar to include these.

Andrew

Komiya Takeshi

unread,
Apr 10, 2021, 11:42:27 PM4/10/21
to sphinx...@googlegroups.com
Hi,

I think you need to learn customizing HTML templates to do that.
Please read the templates in RTD theme and this document.
https://www.sphinx-doc.org/en/master/templating.html

Thanks,
Takeshi KOMIYA

2021年4月11日(日) 5:20 Andrew Back <arb...@gmail.com>:
>
> I'm using RTD theme and would like to include additional images in the sidebar, similar to how readthedocs.io has shown adverts in their sidebar. In may case, two images of the same size as the site logo and aligned to the bottom of the sidebar.
>
> First hurdle was that I can't see how to have these additional images copied from the images/ directory at build time, along with the site logo and favicon. Then I wasn't sure what the best way is to modify the sidebar to include these.
>
> Andrew
>
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/e50451d1-0833-4cf6-97aa-b3225e1e688fn%40googlegroups.com.

Andrew Back

unread,
Apr 11, 2021, 2:48:29 AM4/11/21
to sphinx-users
Hi Takeshi,

On Sunday, 11 April 2021 at 04:42:27 UTC+1 i.tk...@gmail.com wrote:
Hi,

I think you need to learn customizing HTML templates to do that.
Please read the templates in RTD theme and this document.
https://www.sphinx-doc.org/en/master/templating.html

Many thanks.

Do you happen to know what mechanism I could use to have an image copied at build time from 'images/' to '_build/html/_static/' along with the site logo etc.?

Regards,

Andrew

Komiya Takeshi

unread,
Apr 11, 2021, 7:42:00 AM4/11/21
to sphinx...@googlegroups.com
How about using `html_static_path` to copy the images?
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path

Thanks,
Takeshi KOMIYA

2021年4月11日(日) 15:48 Andrew Back <arb...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/72604eba-a550-4c0d-9cca-4b00996d4549n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages