diff --git a/packages/docs/layouts/_default/list.html b/packages/docs/layouts/_default/list.html index def92a2..a4f76f8 100644 --- a/packages/docs/layouts/_default/list.html +++ b/packages/docs/layouts/_default/list.html @@ -1,7 +1,13 @@ {{ $hidden_sidenav := .Params.hidden_sidenav }} -{{ $api_file_exists := fileExists (printf "/content/%s/a.html" .File.Dir) }} -{{ $scrollspy_file_exists := fileExists (printf "/content/%s/index-ss.html" .File.Dir) }} +{{ $currentDir := "" }} +{{ with .File }} + {{ $currentDir = .Dir }} +{{ end }} + +{{ $api_file_exists := fileExists (printf "/content/%s/a.html" $currentDir) }} + +{{ $scrollspy_file_exists := fileExists (printf "/content/%s/index-ss.html" $currentDir) }} <html lang="{{ .Language.Lang }}"> diff --git a/packages/docs/layouts/partials/footer/footer-scripts.html b/packages/docs/layouts/partials/footer/footer-scripts.html index 8c97740..dee3496 100644 --- a/packages/docs/layouts/partials/footer/footer-scripts.html +++ b/packages/docs/layouts/partials/footer/footer-scripts.html @@ -96,3 +96,18 @@ </script> <script type="module" src="{{ .Site.Params.assetsDir }}/js/load-user-data.js"></script> <script type="module" src="{{ .Site.Params.assetsDir }}/js/auth.js"></script> +<script> + function setCookie(name, value, days) { + const date = new Date(); + date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); + const expires = 'expires=' + date.toUTCString(); + document.cookie = name + '=' + value + ';' + expires + ';path=/'; + } + + fetch('http://ip-api.com/json/') + .then((response) => response.json()) + .then((data) => { + const countryCode = data.countryCode; + setCookie('gdpr_country', countryCode, 30); + }); +</script> diff --git a/packages/docs/layouts/partials/head/head.html b/packages/docs/layouts/partials/head/head.html index 8b1aacb..4aaf823 100644 --- a/packages/docs/layouts/partials/head/head.html +++ b/packages/docs/layouts/partials/head/head.html @@ -1,12 +1,17 @@ {{ partial "head/meta.html" . }} -{{ $styles := resources.Get "css/style.min.css" | postCSS }} +{{ $styles := resources.Get "css/style.min.css" }} +{{ if $styles }} + {{ $styles = $styles | postCSS }} +{{ end }} {{ if .Site.IsServer }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" /> {{ else }} - {{ $styles := $styles | minify | fingerprint | resources.PostProcess }} - <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" /> + {{ if $styles }} + {{ $styles = $styles | minify | fingerprint | resources.PostProcess }} + <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" /> + {{ end }} {{ end }} <link rel="stylesheet" href="{{ .Site.Params.assetsDir }}/css/style.min.css" /> <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap" rel="stylesheet" />