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

Remove static footer content #578

Closed
wants to merge 4 commits into from
Closed

Conversation

humitos
Copy link
Member

@humitos humitos commented Feb 15, 2018

This content is injected by an AJAX call to the server.

Ref: https://github.com/readthedocs/readthedocs-corporate/issues/208

@humitos
Copy link
Member Author

humitos commented Feb 15, 2018

I tested by myself manually, but probably this will need more eyes for this since it's a tricky edge case.

@Blendify
Copy link
Member

Hmm... Currently, it is possible for people not on RTD to use this to add versioning support themselves (with the help of #574) See also #543 I think this is something we should support.

Also, I cannot open that link, I assume we need special permissions or something? So not sure if this is actually fixing anything.

@humitos
Copy link
Member Author

humitos commented Feb 15, 2018

Hmm... Currently, it is possible for people not on RTD to use this to add versioning support themselves (with the help of #574) See also #543 I think this is something we should support.

Oh, I see that you added a theme_versioning so removing this code as I did, won't only affect RTD users :/

Anyway, I don't understand how the use of this theme outside RTD would allow the user to have multiple versions.

Also, I cannot open that link, I assume we need special permissions or something? So not sure if this is actually fixing anything.

Yeah, it's the private repo of readthedocs.com. Basically, the problem is that the AJAX request fails for any reason, the footer is not overriden and the one that is generated by this template is invalid and cause problems. So, basically, when running on RTD there is no need to create that footer statically.

In the PR that you pointed me, we will still have the problem I'm trying to fix. So, we need to find a different solution, but I need to understand how the user will use multiples versions first, I guess.

@Blendify
Copy link
Member

Blendify commented Feb 15, 2018

Anyway, I don't understand how the use of this theme outside RTD would allow the user to have multiple versions.

If people manually add the html_context information they can upload the files to their server in the same structure.
An alternate solution was purposed in #438 that could be made to work on RTD and non RTD users.

@eine
Copy link

eine commented Feb 16, 2018

Anyway, I don't understand how the use of this theme outside RTD would allow the user to have multiple versions.

You can have a look at https://github.com/buildthedocs/ and https://github.com/buildthedocs/btd. The build procedure itself is a 300 line shell script: https://github.com/buildthedocs/btd/blob/master/btd/build.sh

It's just a proof-of-concept (yet), so it is far from being ready for production. However, there a couple of sites which are already built with it:

Note that I did some 'minor' visual modifications, which make the theme look slightly different, but the plain rtd theme would also work: https://github.com/buildthedocs/sphinx_btd_theme/tree/add-versioning. These modifications are:

  • Show three buttons in top-right: go to repo, view source and edit source.
  • Add both, the commit SHA and the build number (from travis) to the 'last updated' line. Move it from the footer to the header.
  • Make the link to the PDF and the tarball be font-awesome icons, which are shown next to the version name (in the bottom-left menu).
  • Use a select box to switch between versions.
  • The ghdl site has a theme_override.css that changes several font sizes and dimensions.

In the end, buildthedocs is just a shell version of what I thought that readthedocs-build was meant for. See readthedocs/readthedocs-build#35.

Hint: in order to pass context info from shell script(s) to python, a json file file is used. buildthedocs generates a context.json file in the folder where conf.py is located. Then, you need to add this snippet to the config file: https://github.com/buildthedocs/btd/blob/master/doc/conf.py#L141-L145

@Blendify
Copy link
Member

Since this is a rather big change I purpose we wait till after 0.2.5 to merge this and #574. Unless that other task is urgent. Unless we can quickly come up with a solution for both. But we have already been stretching this much need release for a year now.

@agjohnson
Copy link
Collaborator

As raised on another issue, we don't want to support build tools that aren't Read the Docs with our theme, maintenance across our repositories is already spread thin and this complicates things more.

Because we need to remove this block on readthedocs.com and readthedocs.org, there are only two cases we should support here:

  • Complete removal on Read the Docs, as this is populated with API calls
  • A testing version for local development. The styles live here for now, so we should be testing them here too.

Eventually the menu is to going to be reworked entirely and I'm not yet sure where this lives. I think it makes sense to maintain the menu styling inside RTD and at that point, the menu becomes a generalized feature specific to RTD, not our Sphinx theme. We're still shaping thoughts here though, so this is a future design decision.

For now, it probably makes sense to wrap the menu in conditional logic so that it's off by default on RTD. This preserves local development.

Copy link
Collaborator

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

Surround this in a conditional block, perhaps even a named block.

@humitos humitos force-pushed the humitos/footer/remove-static branch from 609144c to ea6f59e Compare February 28, 2018 00:33
@humitos
Copy link
Member Author

humitos commented Feb 28, 2018

@agjohnson I'm not 100% sure if this way of wrapping that static menu is the correct. Please, let me know.

(I explained my idea in the commit message on how it should work)

Copy link
Member

@Blendify Blendify left a comment

Choose a reason for hiding this comment

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

LGTM if this is the way we are going to go on RTD.

@agjohnson agjohnson added this to the v0.4.0 milestone Mar 29, 2018
Copy link
Collaborator

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

This currently breaks the local dev for the menu. We'll need a method that allows for local dev on the menu here for now (as we haven't begun discussing stylizing the menu elsewhere) and allows for disabling on read the docs.

In readthedocs.com/.org is not needed the usage of the bottom left
versions menu, so we are making this a theme config to control it from
outside.

The default value is to add the menu (too keep backward compatibility).
@humitos humitos force-pushed the humitos/footer/remove-static branch from 1b224cb to dfc569a Compare April 4, 2018 02:46
@humitos
Copy link
Member Author

humitos commented Apr 4, 2018

I make this versions_menu a theme config which is True by default so it doesn't change the current theme.

We will need to define it under html_theme_options in .com/.org to override this and use False for that setting.

Please, let me know if this is correct since "I have no idea what I'm doing" :)

Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

I like this approach much better. It's backwards compat, and lets us configure it the way we want. 👍

@@ -7,6 +7,7 @@
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{% if theme_versions_menu %}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this should go above, on the include versions.html part? Do we really want all the above HTML in the theme around versions when there isn't a version menu to display?

Copy link
Member

Choose a reason for hiding this comment

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

We still need this for the ajax call though.

@@ -7,6 +7,7 @@
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{% if theme_versions_menu %}
Copy link
Member

Choose a reason for hiding this comment

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

Clean up the whitespace with {%- if theme_versions_menu %} else we get 20 blank lines if this is false

http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control

@@ -7,6 +7,7 @@
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{% if theme_versions_menu %}
Copy link
Member

Choose a reason for hiding this comment

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

You should ask explicitly if this true and cast it to bool.

@humitos
Copy link
Member Author

humitos commented Jun 10, 2019

Is this PR something we are still interested in merging or should we close it?

@stsewd
Copy link
Member

stsewd commented Dec 3, 2020

So, basically, when running on RTD there is no need to create that footer statically.

I think this was because of the footer not working with the authentication system in rtd. But now we don't have that problem. And actually we do use this as backup when we are on high load, and we disable the footer for a while.

Also, I think a better way would be to just check if there are versions, if users don't want to put versions they simple just set versions to empty, this is in a non-rtd hosted project.

@Blendify Blendify modified the milestones: 0.6, 1.0.0 Mar 13, 2021
@agjohnson agjohnson removed this from the 1.0 milestone Mar 17, 2021
@Blendify Blendify added this to the 1.0 milestone Mar 30, 2021
Blendify added a commit that referenced this pull request Mar 30, 2021
The removes all the if checks for read the docs.

On read the docs builds this content is now injected. However, we want to support non read the docs builds and provide a way to generate the version menu.

This diff includes changes from #578 and #983
@Blendify
Copy link
Member

Closing in favor of #1107

@Blendify Blendify closed this Mar 30, 2021
@Blendify Blendify deleted the humitos/footer/remove-static branch March 30, 2021 19:12
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.

6 participants