Browse Source

add matomo, slim down a few lines

pull/1/head
max.mehl 3 years ago
parent
commit
0bc20b77b3
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 1
      .gitignore
  2. 14
      layouts/partials/matomo.html
  3. 36
      static/matomo-proxy.php
  4. 14
      static/piwik.php
  5. 6
      themes/hugo-sustain/layouts/_default/single.html
  6. 2
      themes/hugo-sustain/layouts/partials/footer.html
  7. 33
      themes/hugo-sustain/layouts/partials/social.html

1
.gitignore

@ -1,2 +1,3 @@
resources/
public/
static/proxy.php

14
layouts/partials/matomo.html

@ -0,0 +1,14 @@
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//mehl.mx/";
_paq.push(["setTrackerUrl", u+"piwik.php"]);
_paq.push(["setSiteId", "9"]);
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
g.type="text/javascript"; g.async=true; g.defer=true; g.src=u+"piwik.php"; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Piwik Code -->

36
static/matomo-proxy.php

@ -0,0 +1,36 @@
<?php
define('MATOMO_PROXY_FROM_ENDPOINT', 1);
$path = 'index.php';
$SUPPORTED_METHODS = [
'CoreAdminHome.optOut'
];
$VALID_FILES = [
'plugins/CoreAdminHome/javascripts/optOut.js'
];
$module = isset($_GET['module']) ? $_GET['module'] : null;
if (empty($module)) {
$module = isset($_POST['module']) ? $_POST['module'] : null;
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
if (empty($action)) {
$action = isset($_POST['action']) ? $_POST['action'] : null;
}
$filerequest = isset($_GET['file']) ? $_GET['file'] : null;
if (empty($filerequest)) {
$filerequest = isset($_POST['file']) ? $_POST['file'] : null;
}
if (!(isset($filerequest) && in_array($filerequest, $VALID_FILES))
&& !(isset($module) && isset($action) && in_array("$module.$action", $SUPPORTED_METHODS))
) {
http_response_code(404);
exit;
}
include dirname(__FILE__) . '/proxy.php';

14
static/piwik.php

@ -0,0 +1,14 @@
<?php
/**
* Piwik - free/libre analytics platform
* Piwik Proxy Hide URL
*
* @link http://piwik.org/faq/how-to/#faq_132
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
define('MATOMO_PROXY_FROM_ENDPOINT', 1);
$path = "piwik.php";
include dirname(__FILE__) . '/proxy.php';

6
themes/hugo-sustain/layouts/_default/single.html

@ -56,6 +56,12 @@
<!-- Footer -->
{{ partial "footer" . }}
<!-- JS -->
{{ partial "js" . }}
<!-- Matomo -->
{{ partial "matomo" . }}
</body>
</html>

2
themes/hugo-sustain/layouts/partials/footer.html

@ -6,5 +6,3 @@
</div>
</footer>
<div class="footer"></div>
{{ partial "js" . }}

33
themes/hugo-sustain/layouts/partials/social.html

@ -1,36 +1,35 @@
<div class="social">
<ul class="social-links">
{{ with .Site.Params.Social.Email }}
<li><a href="{{ . }}" title="Email"><i class="fa fa-envelope"></i></a></li>
{{- with .Site.Params.Social.Email -}}
<li><a href="{{- . -}}" title="Email"><i class="fa fa-envelope"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Mastodon }}
<li><a href="https://{{ . }}" title="Mastodon"><i class="fab fa-mastodon"></i></a></li>
{{- with .Site.Params.Social.Mastodon -}}
<li><a href="https://{{- . -}}" title="Mastodon"><i class="fab fa-mastodon"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Twitter }}
<li><a href="https://twitter.com/{{ . }}" title="Twitter"><i class="fab fa-twitter"></i></a></li>
{{- with .Site.Params.Social.Twitter -}}
<li><a href="https://twitter.com/{{- . -}}" title="Twitter"><i class="fab fa-twitter"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Diaspora }}
<li><a href="https://{{ . }}" title="Diaspora"><i class="fab fa-diaspora"></i></a></li>
{{- with .Site.Params.Social.Diaspora -}}
<li><a href="https://{{- . -}}" title="Diaspora"><i class="fab fa-diaspora"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Stackoverflow }}
<li><a href="https://stackoverflow.com/{{ . }}" title="Stackoverflow"><i class="fab fa-stack-overflow"></i></a></li>
{{- with .Site.Params.Social.Stackoverflow -}}
<li><a href="https://stackoverflow.com/{{- . -}}" title="Stackoverflow"><i class="fab fa-stack-overflow"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Git }}
<li><a href="{{ . }}" title="Git"><i class="fab fa-git"></i></a></li>
{{- with .Site.Params.Social.Git -}}
<li><a href="{{- . -}}" title="Git"><i class="fab fa-git"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.Github }}
<li><a href="https://github.com/{{ . }}" title="Github"><i class="fab fa-github"></i></a></li>
{{- with .Site.Params.Social.Github -}}
<li><a href="https://github.com/{{- . -}}" title="Github"><i class="fab fa-github"></i></a></li>
{{ end }}
{{ with .Site.Params.Social.LinkedIn }}
<li><a href="https://linkedin.com/in/{{ . }}" title="LinkedIn"><i class="fab fa-linkedin"></i></a></li>
{{- with .Site.Params.Social.LinkedIn -}}
<li><a href="https://linkedin.com/in/{{- . -}}" title="LinkedIn"><i class="fab fa-linkedin"></i></a></li>
{{ end }}
</ul>
</div>

Loading…
Cancel
Save