FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add `hosted_on` variable for a link in the footer by hugovk · Pull Request #165 · python/python-docs-theme · GitHub

Repository navigation

Add hosted_on variable for a link in the footer - #165

Merged
hugovk merged 2 commits into
python:mainfrom
hugovk:hosted-on
Jan 27, 2024
Merged

hugovk merged 2 commits into
python:mainfrom
hugovk:hosted-on

Conversation

hugovk commented Jan 26, 2024

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

Conditional

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

if os.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:

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:

willingc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looks good to me. Thanks @hugovk

hugovk merged commit 3f45850 into python:main Jan 27, 2024
hugovk deleted the hosted-on branch January 27, 2024 14:53

hugovk commented Jan 29, 2024

Copy link
Copy Markdown
Member Author

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL