Skip to content

Conversation

@hugovk
Copy link
Member

Helps python/docs-community#5.

If hosted_on is defined in your docs' conf.py:

html_theme_options={'collapsiblesidebar': True, 'hosted_on': '<a href="https://example.com">Example</a>', 'issues_url': '/bugs.html', 'license_url': '/license.html', 'root_include_title': False# We use the version switcher instead. }

Adds a "Hosted by" line to the footer:

image

Conditional

For python/docs-community#5, we can instead add this in conf.py:

ifos.getenv("READTHEDOCS"): html_theme_options["hosted_on"] ='<a href="https://about.readthedocs.com/">Read the Docs</a>'

And we'll only get the "Hosted by" line for builds created on Read the Docs:

image

Here's a demo build:

If you build that locally or on another server which doesn't have the env var defined, we don't get the link:

image

Copy link
Contributor

@willingcwillingc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks @hugovk

@hugovkhugovk merged commit 3f45850 into python:mainJan 27, 2024
@hugovkhugovk deleted the hosted-on branch January 27, 2024 14:53
@hugovk
Copy link
MemberAuthor

This has now been released, so here's the follow-up: python/cpython#114697

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@hugovk@willingc