-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Addons: load_when_embedded
config
#11765
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
Conversation
00bcd15
to
0fe2246
Compare
Add an extra addons config to decide whether or not force the injection of addons when the page is embedded (eg. iframe). By default, we are not loading addons if embedded. Required by readthedocs/addons#415 Closes readthedocs/addons#412
X-RTD-Load-Addons-When-Embedded
HTTP headerload_when_embedded
config
0fe2246
to
7095954
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a note on naming.
We talked about giving users a way to inject a JavaScript file they control using our Cloudflare Worker infrastructure to allow them manipulate frozen documentations. This could be used in different ways to fix bugs or add features to a particular frozen set of docs or even to all the versions. The user can make usage of API data to filter by version or not (e.g. `if (versions.current == "v3.0") { .. do something ...} `) The script could live in Read the Docs itself using a relative URL, or outside it, using an absolute URL. ### Example using Sphinx 1. [Tell Sphinx to include `static` folder](https://github.com/readthedocs/test-builds/blob/full-feature/docs/conf.py#L25) 2. [Include a `readthedocs.js` file in your project](https://github.com/readthedocs/test-builds/blob/full-feature/docs/static/readthedocs.js) 3. Make `AddonsConfig.userjsfile_src` to be `/en/full-feature/readthedocs.js` from addons admin UX The console will render the following:  Related #11474 Related readthedocs/addons#431
"configs": { | ||
"load_when_embedded": false | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.com tests will probably need to be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I don't think we have this file in .com. At least, I didn't find it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have two files in tests/responses/addons/
…thedocs/readthedocs.org into humitos/addons-embedded-http-header
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Add an extra addons config to decide whether or not force the injection of addons when the page is embedded (eg. iframe). By default, we are not loading addons if embedded.
Required by readthedocs/addons#415
Closes readthedocs/addons#412