Skip to content

Commit

Permalink
add google ad
Browse files Browse the repository at this point in the history
Signed-off-by: chang-ning <[email protected]>
  • Loading branch information
crazyguitar committed Oct 6, 2018
1 parent 7cd1bf8 commit 6a1bf71
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
11 changes: 2 additions & 9 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ def find_key(token):
csp = {
"default-src": "'none'",
"style-src": ["'self'", "'unsafe-inline'"],
"script-src": [
"'self'",
"*.cloudflare.com",
"*.googletagmanager.com",
"*.google-analytics.com",
"'unsafe-inline'",
"'unsafe-eval'",
],
"script-src": ["'self'", "*", "'unsafe-inline'", "'unsafe-eval'"],
"form-action": "'self'",
"base-uri": "'self'",
"img-src": "*",
"frame-src": "ghbtns.com",
"frame-src": ["ghbtns.com", "googleads.g.doubleclick.net"],
"frame-ancestors": "'none'",
"object-src": "'none'",
}
Expand Down
9 changes: 9 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,14 @@
gtag('config', '{{ tracking_id }}');
</script>
{% endif -%}
{%- if google_ad_client %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "{{ google_ad_client }}",
enable_page_level_ads: true
});
</script>
{% endif -%}
{% endblock %}
{% set css_files = css_files + [ "_static/style.css" ] %}
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "pysheeet"
html_context = {"tracking_id": os.environ.get("TRACKING_ID")}
html_context = {
"tracking_id": os.environ.get("TRACKING_ID"),
"google_ad_client" : os.environ.get("GOOGLE_AD_CLIENT")
}

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand Down

0 comments on commit 6a1bf71

Please sign in to comment.