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

Enable ads on the readthedocs mkdocs theme #3922

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion readthedocs/core/static-src/core/js/doc-embed/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
var exports = {
THEME_RTD: 'sphinx_rtd_theme',
THEME_ALABASTER: 'alabaster',
THEME_CELERY: 'sphinx_celery'
THEME_CELERY: 'sphinx_celery',
THEME_MKDOCS_RTD: 'readthedocs'
};

exports.PROMO_SUPPORTED_THEMES = [
Expand Down
8 changes: 7 additions & 1 deletion readthedocs/core/static-src/core/js/doc-embed/rtd-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ var configMethods = {
return (!('builder' in this) || this.builder !== 'mkdocs');
},

is_mkdocs_builder: function () {
return (!('builder' in this) || this.builder === 'mkdocs');
},

get_theme_name: function () {
// Crappy heuristic, but people change the theme name on us. So we have to
// do some duck typing.
if (this.theme !== constants.THEME_RTD) {
if (this.theme === constants.THEME_MKDOCS_RTD) {
return constants.THEME_RTD;
}
if ($('div.rst-other-versions').length === 1) {
return constants.THEME_RTD;
}
Expand All @@ -33,7 +40,6 @@ var configMethods = {
show_promo: function () {
return (
this.api_host !== 'https://readthedocs.com' &&
this.is_sphinx_builder() &&
this.theme_supports_promo());
}
};
Expand Down
5 changes: 4 additions & 1 deletion readthedocs/core/static-src/core/js/doc-embed/sponsorship.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ function create_sidebar_placement() {
var selector = null;
var class_name; // Used for theme specific CSS customizations

if (rtd.is_rtd_theme()) {
if (rtd.is_mkdocs_builder() && rtd.is_rtd_theme()) {
selector = 'nav.wy-nav-side';
class_name = 'ethical-rtd';
} else if (rtd.is_rtd_theme()) {
selector = 'nav.wy-nav-side > div.wy-side-scroll';
class_name = 'ethical-rtd';
} else if (rtd.get_theme_name() === constants.THEME_ALABASTER ||
Expand Down