mirror of https://github.com/docker/docs.git
Move polldaddy script to an include, and update some options
- use a config-variable for the ID - exclude the script if no ID is set - set default font and font-color Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
9bebb666d9
commit
8bf577084a
|
@ -16,6 +16,7 @@ exclude: ["_scripts", "tests", "apidocs/layouts", "Gemfile", "hooks", "index.htm
|
||||||
# Google Analytics, etc.
|
# Google Analytics, etc.
|
||||||
# TODO these should only be set when building for production, or passed as an environment variable when building
|
# TODO these should only be set when building for production, or passed as an environment variable when building
|
||||||
google_analytics: GTM-WL2QLG5
|
google_analytics: GTM-WL2QLG5
|
||||||
|
polldaddy_id: 8453675
|
||||||
|
|
||||||
|
|
||||||
# Component versions -- address like site.docker_ce_version
|
# Component versions -- address like site.docker_ce_version
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{%- if site.polldaddy_id and site.polldaddy_id != '' -%}
|
||||||
|
<script>
|
||||||
|
let PDRTJS_settings_{{ site.polldaddy_id }} = {
|
||||||
|
"id": "{{ site.polldaddy_id }}",
|
||||||
|
"unique_id": "{{ page.path }}",
|
||||||
|
"title": "{{ page.title | default: page_title }}",
|
||||||
|
"font_family": "Open Sans, sans serif",
|
||||||
|
"font_color": "b9c2cc",
|
||||||
|
"font_align": "center",
|
||||||
|
"permalink": "https://github.com/docker/docker.github.io/blob/master/{{ page.path }}"
|
||||||
|
};
|
||||||
|
(function (d, c, j) {
|
||||||
|
if (!document.getElementById(j)) {
|
||||||
|
let pd=d.createElement(c),s;pd.id=j;pd.src='https://polldaddy.com/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd, s);
|
||||||
|
}
|
||||||
|
}(document, 'script', 'pd-rating-js'));
|
||||||
|
</script>
|
||||||
|
{%- endif -%}
|
|
@ -33,8 +33,8 @@
|
||||||
</span>
|
</span>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endunless %}
|
{%- endunless %}
|
||||||
{%- if page.noratings != true -%}
|
{%- if site.polldaddy_id and page.noratings != true -%}
|
||||||
<div class="ratings-div"><div id="pd_rating_holder_8453675"></div></div>
|
<div class="ratings-div"><div id="pd_rating_holder_{{ site.polldaddy_id }}"></div></div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
|
@ -96,21 +96,5 @@
|
||||||
<script defer src="/js/docs.js"></script>
|
<script defer src="/js/docs.js"></script>
|
||||||
<script defer src="/js/toc.js"></script>
|
<script defer src="/js/toc.js"></script>
|
||||||
<script defer src="/js/search.js"></script>
|
<script defer src="/js/search.js"></script>
|
||||||
<script>
|
{%- include analytics/polldaddy.html -%}
|
||||||
PDRTJS_settings_8453675 = {
|
|
||||||
"id": "8453675",
|
|
||||||
"unique_id": "{{ page.path }}",
|
|
||||||
"title": "{{ page.title | default: page_title }}",
|
|
||||||
"permalink": "https://github.com/docker/docker.github.io/blob/master/{{ page.path }}"
|
|
||||||
};
|
|
||||||
(function (d, c, j) {
|
|
||||||
if (!document.getElementById(j)) {
|
|
||||||
var pd = d.createElement(c), s;
|
|
||||||
pd.id = j;
|
|
||||||
pd.src = ('https:' === document.location.protocol) ? 'https://polldaddy.com/js/rating/rating.js' : 'http://i0.poll.fm/js/rating/rating.js';
|
|
||||||
s = document.getElementsByTagName(c)[0];
|
|
||||||
s.parentNode.insertBefore(pd, s);
|
|
||||||
}
|
|
||||||
}(document, 'script', 'pd-rating-js'));
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue