Merge pull request #41 from softinio/revert-40-revert-39-add-new-analytics

add matomo back and add peertube shortcode
This commit is contained in:
Salar Rahmanian 2021-11-21 22:36:11 -08:00 committed by GitHub
commit 39a4cc2f26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 0 deletions

View file

@ -28,6 +28,7 @@ twitter = "@SalarRahmanian"
largeTwitterCard = false
introDescription = "Software Engineer based in San Francisco Bay Area."
ga_analytics = "UA-47014432-1"
matomo_site_id = "2"
numberOfTagsShown = 14
fallBackOgImage = "salar.jpg"
codeMaxLines = 10

View file

@ -0,0 +1,24 @@
{{- with .Site.Params.ga_analytics }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ . }}');
</script>
{{- end -}}
{{- with .Site.Params.matomo_site_id }}
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//softinio.dev/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{.}}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
{{- end -}}

14
layouts/peertube.html Normal file
View file

@ -0,0 +1,14 @@
{{ if .IsNamedParams -}}
<div style="position: relative; padding-bottom: 56.25%; margin-bottom: 1rem; height: 0; overflow: hidden;">
<iframe sandbox="allow-scripts allow-popups" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"
src="https://{{ .Get "host" }}/videos/embed/{{ .Get "id" }}?{{ with .Get "title" }}title={{ . }}{{ else }}title=0{{ end }}&{{ with .Get "warning" }}warningTitle={{ . }}{{ else }}warningTitle=0{{ end }}{{ with .Get "subtitle" }}&subtitle={{ . }}{{ end }}&peertubeLink=0" allowfullscreen>
</iframe>
</div>
{{- else -}}
<div style="position: relative; padding-bottom: 56.25%; margin-bottom: 1rem; height: 0; overflow: hidden;">
<iframe sandbox="allow-scripts allow-popups" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;"
src="https://{{ .Get 0 }}/videos/embed/{{ .Get 1 }}?title=0&warningTitle=0&peertubeLink=0" title="Peertube Video" allowfullscreen>
</iframe>
</div>
{{- end }}