mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-07-17 12:01:57 +00:00
feat: Add Intercom widget
This commit is contained in:
parent
34918d009a
commit
4e48851612
7
assets/intercom.js
Normal file
7
assets/intercom.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
//Set your APP_ID
|
||||||
|
var APP_ID = '{{ .Site.Params.IntercomAppId }}'
|
||||||
|
|
||||||
|
window.intercomSettings = {
|
||||||
|
app_id: APP_ID
|
||||||
|
};
|
||||||
|
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
|
@ -40,6 +40,11 @@
|
|||||||
{{- partial "docs/segment.html" . -}}
|
{{- partial "docs/segment.html" . -}}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
|
{{- if .Site.Params.IntercomAppId -}}
|
||||||
|
{{- $intercomJS := resources.Get "intercom.js" | resources.ExecuteAsTemplate "intercom.js" . | resources.Minify | resources.Fingerprint }}
|
||||||
|
<script defer src="{{ $intercomJS.RelPermalink }}" {{ template "integrity" $intercomJS }}></script>
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
{{- template "_internal/google_analytics.html" . -}}
|
{{- template "_internal/google_analytics.html" . -}}
|
||||||
|
|
||||||
<!-- RSS -->
|
<!-- RSS -->
|
||||||
|
Loading…
Reference in New Issue
Block a user