diff --git a/openlibrary/plugins/upstream/utils.py b/openlibrary/plugins/upstream/utils.py index 6595071fc40..1d227ab2964 100644 --- a/openlibrary/plugins/upstream/utils.py +++ b/openlibrary/plugins/upstream/utils.py @@ -1434,25 +1434,6 @@ def jsdef_get(obj, key, default=None): return obj.get(key, default) -@public -def get_donation_include() -> str: - ia_host = get_ia_host(allow_dev=True) - # The following allows archive.org staff to test banners without - # needing to reload openlibrary services - # Note donate.js also reads the ?ymd=YYYYMMDD parameter and the - # `variant` parameter. - if ia_host != "archive.org": - script_src = f"https://{ia_host}/includes/donate.js" - else: - script_src = "/cdn/archive.org/donate.js" - - html = f""" -
- - """ - return html - - @public def get_ia_host(allow_dev: bool = False) -> str: if allow_dev: diff --git a/openlibrary/templates/site/alert.html b/openlibrary/templates/site/alert.html index 40f060b48a0..781cc22f8f8 100644 --- a/openlibrary/templates/site/alert.html +++ b/openlibrary/templates/site/alert.html @@ -1,5 +1,5 @@ $if not is_bot(): - $:get_donation_include() + $:render_template('site/donation_banner') $ lang = get_lang() or 'en' $ supported_languages = get_supported_languages() diff --git a/openlibrary/templates/site/donate.html b/openlibrary/templates/site/donate.html deleted file mode 100644 index 7bc7b424819..00000000000 --- a/openlibrary/templates/site/donate.html +++ /dev/null @@ -1,3 +0,0 @@ - -$if not is_bot(): - $:get_donation_include() diff --git a/openlibrary/templates/site/donation_banner.html b/openlibrary/templates/site/donation_banner.html new file mode 100644 index 00000000000..fa15162fd4b --- /dev/null +++ b/openlibrary/templates/site/donation_banner.html @@ -0,0 +1,13 @@ +$ ia_host = get_ia_host(allow_dev=True) + +$# The following allows archive.org staff to test banners without +$# needing to reload openlibrary services +$# Note donate.js also reads the ?ymd=YYYYMMDD parameter and the +$# `variant` parameter. +$if ia_host != "archive.org": + $ script_src = "https://%s/includes/donate.js" % ia_host +$else: + $ script_src = "/cdn/archive.org/donate.js" + + +