removed google analytics in favor of fanthom

This commit is contained in:
wgroeneveld 2020-05-26 17:01:24 +02:00
parent f2f065f688
commit 7121123b05
8 changed files with 107 additions and 20 deletions

View File

@ -2,7 +2,6 @@ languageCode = "en-us"
title = "Brain Baking"
baseurl = "https://brainbaking.com/"
theme = "minimal"
googleAnalytics = "UA-45748221-1"
publishDir = "docs"
enableEmoji = true
enableRobotsTXT = true
@ -13,6 +12,8 @@ enableGitInfo = true
tag = "tags"
[params]
fathomid = "WNLTO"
# disabled to get rid of cloudflare cookies
MathJax = false
@ -45,6 +46,16 @@ enableGitInfo = true
style = "arduino"
tabWidth = 4
[privacy]
[privacy.googleAnalytics]
anonymizeIP = true
disable = false
respectDoNotTrack = false
useSessionStorage = false
[privacy.youtube]
disable = false
privacyEnhanced = true
[[menu.main]]
name = "Tech Blog"
pre = "<i class='fa fa-file-code-o'></i>"

View File

@ -35,8 +35,8 @@ Garlic and onions, as the star vegetable, can be tackled with ease if you grow y
The hard cheese might be a tough one if you insist on the Parmesan, which is a DOP: __Denominazione di origine protetta__. That means it's called only Parmesan if it's from a specific region Italy. But Belgium and the Netherlands **are** exceptionally good in making cheese, even hard and salty cheeses, like [Friese Nagelkaas](https://nl.wikipedia.org/wiki/Friese_nagelkaas). Of course we said we'll stick to the recipe but instead of using Pecorino, you can try very old Dutch sheep's cheese.<br/>
'Mozzarella di bufala', one of the tastiest fresh Italian style cheeses, are almost always imported from Italy. But why? If you really bother to look, Belgium makes [it's own mozzarella di bufala](http://www.bufflardenne.be/) (it shouldn't be called that because of the protective DOP label but who cares) and it's simply superior in taste. The only problem is that you'll have to drive to another shop - that might even be outside of your comfort zone.
![Buffl](/img/buffl.jpg)<br/>
_Real_ local stuff, right here - if you look for it.
{{< figure src="/img/buffl.jpg" title="Real local stuff, right here - if you look for it." >}}
### Why are all pine nuts from China?
@ -50,8 +50,8 @@ It's a shame that people buy less and less responsible, but go out on restaurant
### Reintroducing domestic science
![domestic science](/img/domestic.jpg)<br/>
Image copyright theparkschoolpreston.co.uk
{{< figure src="/img/domestic.jpg" title="Image copyright theparkschoolpreston.co.uk" >}}
Instead of focusing on mathematics, linguistics and economics in schools, let's reintroduce household techniques as an integrated part of our youth's training course. Previously, one of the family members dedicated his/hers (usually the latter) time on grocery shopping, cooking, knowing what's good for you and what's not and knowing what grows in what season. Now, if you're lucky, you or your partner is interested in the subject or you simply like cooking and you'll end up with at least a piece of the puzzle. I was one of those people who had no general idea about seasons. Try gardening, it solves a lot of problems (but introduces new ones like snails).

View File

@ -4,6 +4,7 @@ date: '2020-05-15'
subtitle: "Sass, Transpiling, Search functionality - what's not to like?"
tags:
- hugo
- webdesign
- babel
- sass
published: true

View File

@ -5,6 +5,7 @@ bigimg: /img/brizy.jpg
subtitle: Shortcodes and custom hacks incoming...
tags:
- php
- webdesign
- wordpress
- brizy
---
@ -77,7 +78,28 @@ Oh, did I mention that I had to style these things myself? Since you can't use t
#### The Category page
Right, "terms" in Wordpress. Are you using tags or categories? Or did you create your own taxonomy? What's with all the complexity when I just want a simple way to sort and organize my blog posts? Here, I used another self-made shortcode, `[show_current_category]`.
Right, "terms" in Wordpress. Are you using tags or categories? Or did you create your own taxonomy? What's with all the complexity when I just want a simple way to sort and organize my blog posts? Here, I used another self-made shortcode, `[show_current_category]`, that is a wrapper around `[display-posts]` to apply the category filter scraped from the request URL (usually something like `/category/blabla`):
```php
$show_current_category_in = FALSE;
function show_current_category_shortcode() {
global $show_current_category_in;
if($show_current_category_in == TRUE) return '';
$show_current_category_in = TRUE;
$cat = str_replace('/', '', str_replace('category', '', $_SERVER['REQUEST_URI']));
ob_start();
echo "<div class='brz-rich-text'><h2 style='font-family: \'Playfair Display\', serif'>Categorie: $cat</h2></div><hr/>";
echo do_shortcode('[display-posts category="' . $cat . '" posts_per_page="100" image_size="thumbnail" include_excerpt="true" excerpt_length="30" include_date="true" category_display="true" category_label="" include_excerpt_dash="false" image_size="medium" date_format="d/m/Y"]');
$html = ob_get_contents();
ob_end_clean();
return $html;
}
```
I'm ashamed to even post this on the internet. One of the finest hacks I've ever written, I think. The ugly boolean variable is needed because when a Brizy template gets included as part of the results, it triggers the Wordpress function `get_the_excerpt()` from `[display-posts]`. And the excerpt of this category template page includes the show current category shortcode - back to square one. I'm sure there are better ways to do this, but I lost my patience (and temper) trying to debug this mess, pasting `$e = new \Exception; var_dump($e->getTraceAsString());` in random places.
### The Wordpress mess
@ -115,13 +137,15 @@ Yup:
./3682/assets/images/iW=310&iH=142&oX=0&oY=0&cW=310&cH=142/testlogokristien.png
```
Brizy duplicates images from global bocks for each page, and for each page, Brizy duplicates images for each (mobile) device. `26` images for one page id.
Brizy duplicates images from global bocks for each page, and for each page, Brizy duplicates images for each (mobile) device used in `srcset` attributes of `img` tags. `26` images for one page ID.
There goes my [nginx caching strategy](/post/vps). What a mess. Should I write a bash script to create symlinks? That does not change anything for the clientside webbrowser. What a mess.
### So, trash Brizy and use something else?
Perhaps. But now that we invested a couple of weeks in this Wordpress + Brizy + custom hacks on my side, my wife is content. She's even thinking about the same setup to port one of her websites from Webnode, a paid and hosted service. It's intuitive to use and it works - for the most part. The shortcodes should not change often, and the blog detail and category brizy templates are not that difficult to maintain if you ignore the errors in the editor.
Perhaps. But now that we invested a couple of weeks in this Wordpress + Brizy + custom hacks combination, my wife is content. She's even thinking about using the same setup to port one of her websites from Webnode, a paid and hosted service. It's intuitive to use and it works - for the most part. The shortcodes should not change often, and the blog detail and category brizy templates are not that difficult to maintain if you ignore the errors in the editor.
Oh, and don't bother paying for the coupled "Optimize Images" [shortpixel.com](https://shortpixel.com/pricing-one-time) plugin thing - simply execute `find . -name "*.jpg" -exec convert {} -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB {} \;`. With complements of Google's [Image Optimization Tips](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/image-optimization).
As long as you don't try to peek behind the scenes and into the source code, all is well...

View File

@ -20,7 +20,7 @@
{{ if $related }}
<h4 class="page-header"><i class="fa fa-newspaper-o"></i>&nbsp;Related by Tags</h4>
<h4 class="page-header"><i class="fa fa-newspaper-o"></i>&nbsp;Related Articles</h4>
<div class="text-justify">
{{ range $related }} {{ partial "related-item" . }} {{ end }}

View File

@ -0,0 +1,45 @@
{{ partial "header" . }}
<main>
<h2>
<i class='fa fa-tags'></i>&nbsp;Tagged with: <br/>"{{ .Title }}"
</h2>
<hr/>
{{ with .Content }}
<div class="text-justify">
{{ . }}
</div>
<hr/>
{{ end }}
{{ range .Data.Pages.GroupByDate "01-2006" "desc" }}
<h4 style="float: left; color: grey;">{{ .Key }}</h4>
<ul style="text-align: left; float: left; margin-left: 20px; width: 80%; list-style-type: none; border-left: #eee 1px solid;">
{{ range .Pages.ByDate.Reverse }}
{{ .Date.Format (.Site.Params.dateFormat | default "2 January") | $.Scratch.Set "subtitle" }}
{{ with .Description }} {{ $.Scratch.Set "subtitle" . }} {{ end }}
<li style="margin-bottom: 15px;">
<h4>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h4>
{{ with .Params.archived }}
<kbd class="item-tag">Archived</kbd>
{{ end }}
{{ .Params.subtitle }}
<span style="color: lightgrey;">
<i class='fa fa-calendar'></i>&nbsp;{{ $.Scratch.Get "subtitle" }}
</span>
</li>
{{ end }}
</ul>
<hr style="clear: both;"/>
{{ end }}
</main>
{{ partial "footer" . }}

View File

@ -1,10 +0,0 @@
{{ if .Site.GoogleAnalytics }}
<!-- hugo doesn't provide extra settings like anonymizeIp ... -->
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ .Site.GoogleAnalytics}}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
<script async src='//www.google-analytics.com/analytics.js'></script>
{{ end }}

View File

@ -92,4 +92,20 @@
}
</script>
{{ partial "google_analytics_anonymous.html" . }}
{{- if (ne hugo.Environment "development") }}
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
})(document, window, 'https://fathom.brainbaking.com/tracker.js', 'fathom');
fathom('set', 'siteId', '{{ .Site.Params.fathomid }}');
fathom('trackPageview');
</script>
<!-- / Fathom -->
{{- end }}