Skip to content

Commit

Permalink
Add configuration variables for Google integrations (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Dec 19, 2019
1 parent ee3a0c3 commit a9d1c34
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
10 changes: 0 additions & 10 deletions sphinx_holoviz_theme/includes/ga.html

This file was deleted.

2 changes: 1 addition & 1 deletion sphinx_holoviz_theme/includes/searchbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<button type="submit">
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/search-icon-black.png" alt="Search Icon">
</button>
</form>
</form>

14 changes: 13 additions & 1 deletion sphinx_holoviz_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@
<li class="nav-link doc-head"><a href="{{ pathto(link) }}">{{ name }}</a></li>
{% endfor %}
{% endif %}
{% if GOOGLE_SEARCH_ID %}
<li class="nav-link">
<div style="display:inline-block;vertical-align: middle;">
<div class="search-bar">
{% include 'includes/searchbox.html' %}
</div>
</div>
</li>
{% endif %}
</ul>
</nav>
</div>
Expand Down Expand Up @@ -144,7 +146,17 @@


<!-- Google Analytics -->
{% include 'includes/ga.html' %}
{% if GOOGLE_ANALYTICS_UA %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', {{ GOOGLE_ANALYTICS_UA }}, 'auto');
ga('send', 'pageview');
</script>
{% endif %}

<!-- MathJax Config -->
<script type="text/x-mathjax-config">
Expand Down
5 changes: 3 additions & 2 deletions sphinx_holoviz_theme/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ <h1 id="search-documentation">{{ _('Search') }}</h1>
<span id="search-progress" style="padding-left: 10px"></span>
</form>

{% if GOOGLE_SEARCH_ID %}
<div id="search-results">
<script>
(function() {
var cx = '006807479272082416678:p6n_f0d8taw';
var cx = {{ GOOGLE_SEARCH_ID }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
Expand All @@ -33,7 +34,7 @@ <h1 id="search-documentation">{{ _('Search') }}</h1>
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>

</div>
{% endif %}

{% endblock %}

0 comments on commit a9d1c34

Please sign in to comment.