Skip to content

Be more defensive in how we insert our mkdocs media #5340

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

Closed
ericholscher opened this issue Feb 22, 2019 · 1 comment · Fixed by #5344
Closed

Be more defensive in how we insert our mkdocs media #5340

ericholscher opened this issue Feb 22, 2019 · 1 comment · Fixed by #5344
Labels
Accepted Accepted issue on our roadmap Good First Issue Good for new contributors

Comments

@ericholscher
Copy link
Member

ericholscher commented Feb 22, 2019

This logic can be executed multiple times on some builds (see the mkdocs.yml):

https://github.com/rtfd/readthedocs.org/blob/ed8dd29a68d009fc08929fabf7155883482619c1/readthedocs/doc_builder/backends/mkdocs.py#L143-L152

If we have an issue reseting the branch/tag of the docs, we will end up inserting our media files twice, which causes them to be executed twice.

Solution

This code should check if one of the files we insert is already in the list:

if 'readthedocs-data.js' not in user_config.get('extra_javascript'):
@ericholscher ericholscher added Good First Issue Good for new contributors Accepted Accepted issue on our roadmap labels Feb 22, 2019
@saadmk11
Copy link
Member

Can I work on This Issue?
If I understood the problem correctly we need to add conditions for 'extra_javascript' and 'extra_css'
to check if the static files already exist in the user_config if not then add the files. Please Correct me if I'm Wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Good First Issue Good for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants