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

Experimental: support disabling pretty-urls (for readthedocs) #530

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ebolyen
Copy link

@ebolyen ebolyen commented Feb 6, 2025

A potential solution to the assumption of URLs without extensions (pretty urls) being served from a bare html file noted in jupyter-book/mystmd#984.

Limitations:

  • First time working with this theme, so I probably missed something.
  • No tests yet (want to get feedback on the approach)
  • I've only changed the "book" theme.
  • Doesn't handle the flyout menu in readthedocs, I think that may only need a react upgrade, which I will probably test out soon.

Approach

  • Add a site option for pretty_urls, it is by default interpreted to be true. (I'm not sure if there's a better way to cause a default, but it didn't seem like it since we're relying on the remix loader which just fetches the config.)
  • When false, the book theme will set a React context which various components will look at.
  • I looked at each reference to base_url and worked out if it was relevant. (There is one section that uses base_url in a way that I think might be a bug, but I'm not familiar enough with what "internal" means to this code.)

Alternative

  • Could use MODE == 'static' instead of a new site option, but I think the URL extensions are technically orthogonal. Since some hosts will redirect, and others won't. You might even prefer .html for whatever reason.

Example
https://genome-sampler.readthedocs.io/en/latest/

Copy link

changeset-bot bot commented Feb 6, 2025

⚠️ No Changeset found

Latest commit: 6ea012d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ebolyen
Copy link
Author

ebolyen commented Feb 6, 2025

Thanks @changeset-bot, I'll switch this to a draft.

@ebolyen ebolyen marked this pull request as draft February 6, 2025 16:52
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

Successfully merging this pull request may close these issues.

1 participant