Creating a variable in view to contain Google ads code and including it in a Django cycle template tag for displaying an ad horizontally has been a challenge.
{% block "" "" "" "" "" "<div id='ad' class='col-xs-12 col-lg-12'></div>" "" "" "" "" "" "" "" "" "<div class='col-sm-12'></div></div><div class='row'>" %}
The process seems lengthy but I haven't found another workaround yet.
An attempt was made:
div1 = """<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive -->
<ins class=""
style="display:block"
data-ad-client=""
data-ad-slot=""
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>"""
Inserted within the div tags in the cycle tag:
{% cycle "" "" "" "" "" "<div id='ad' class='col-xs-12 col-lg-12'>div</div>" "" "" "" "" "" "" "" "" "<div class='col-sm-12'></div></div><div class='row'>" %}
Unfortunately, this approach doesn't seem to work inside the cycle template tag.