INCREASE PRIVACY OF YOUR HUGO-BASED WEBSITE

INCREASE PRIVACY OF YOUR HUGO-BASED WEBSITE

I think that any sane person would like to break free from dependencies of big corps and …
No-no-no, no political rant will happen here today, so stay cool.
It’s just a small guide on how to make your Hugo-based site to load faster and do as little external queries as possible.

Here is a classic situation when you load badly designed site. Output of [uMatrix] plugin just for better representation.




1] TUNE CONFIGURATION FILE OF HUGO INSTALLATION [related article in [Hugo manual] ]:

In my case i have TOML syntax.

config.toml

ADD FOLLOWING LINES:

[privacy]
  [privacy.disqus]
    disable = true
  [privacy.googleAnalytics]
    disable = true
  [privacy.instagram]
    disable = true
  [privacy.twitter]
    disable = true
  [privacy.vimeo]
    disable = true
  [privacy.youtube]
    disable = false
    privacyEnhanced = true

2] EDIT BASEOF.HTML OF YOUR TEMPLATE:

..\themes\mainroad\layouts\_default\baseof.html

COMMENT WITH <!-- --!> OR JUST REMOVE THE FOLLOWING GOOGLE RELATED CRAP:

{{- $googleFontsLink := .Site.Params.googleFontsLink | default "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" }}
{{- if hasPrefix $googleFontsLink "https://fonts.googleapis.com/" }}
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="stylesheet" {{ printf `href="%s"` $googleFontsLink | safeHTMLAttr }}>
{{- end }} 
{{- if not .Site.IsServer }}
{{- if hasPrefix .Site.GoogleAnalytics "G-" }}
{{ template "_internal/google_analytics.html" . }}
{{- else }}
{{ template "_internal/google_analytics_async.html" . }}
{{- end }}
{{- end }}



3] RECOMPILE WEBSITE FULLY AND YOU ARE GOOD TO GO!


Remember that this guide is not removing 100% bloat & telemetry injected by shite corps, but at least it substantially improves situation in the field.